ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.204.1

This commit is contained in:
speakeasybot
2024-03-08 01:11:10 +00:00
parent 297fdfa677
commit a19df2f413
40 changed files with 1207 additions and 991 deletions

View File

@@ -3,10 +3,10 @@ id: 3eeea668-4ef4-464e-a888-bdfa023bedf5
management:
docChecksum: e34dac84738ebf2d447ea2b9055a6eeb
docVersion: 0.0.3
speakeasyVersion: 1.202.0
generationVersion: 2.277.0
releaseVersion: 0.3.1
configChecksum: bfb7a5bba42dd91fad6aa593086c003c
speakeasyVersion: 1.204.1
generationVersion: 2.279.1
releaseVersion: 0.4.0
configChecksum: bd151d168c96896726f8c92a667d7abc
repoURL: https://github.com/LukeHagar/plexpy.git
repoSubDirectory: .
installationURL: https://github.com/LukeHagar/plexpy.git
@@ -14,12 +14,13 @@ management:
features:
python:
constsAndDefaults: 0.1.3
core: 4.5.0
core: 4.5.1
flattening: 2.81.1
globalSecurity: 2.83.4
globalServerURLs: 2.82.1
methodServerURLs: 2.82.1
nameOverrides: 2.81.1
responseFormat: 0.1.0
generatedFiles:
- src/plex_api/sdkconfiguration.py
- src/plex_api/server.py
@@ -38,6 +39,7 @@ generatedFiles:
- src/plex_api/sessions.py
- src/plex_api/updater.py
- src/plex_api/sdk.py
- py.typed
- pylintrc
- setup.py
- src/plex_api/__init__.py
@@ -585,7 +587,6 @@ generatedFiles:
- docs/sdks/updater/README.md
- USAGE.md
- .gitattributes
- src/plex_api/_hooks/registration.py
- src/plex_api/_hooks/sdkhooks.py
- src/plex_api/_hooks/types.py
- src/plex_api/_hooks/__init__.py

View File

@@ -33,6 +33,7 @@ res = s.server.get_server_capabilities()
if res.object is not None:
# handle response
pass
```
<!-- End SDK Example Usage [usage] -->
@@ -179,6 +180,7 @@ except errors.SDKError as e:
if res.object is not None:
# handle response
pass
```
<!-- End Error Handling [errors] -->
@@ -209,6 +211,7 @@ res = s.server.get_server_capabilities()
if res.object is not None:
# handle response
pass
```
#### Variables
@@ -235,6 +238,7 @@ res = s.server.get_server_capabilities()
if res.object is not None:
# handle response
pass
```
### Override Server URL Per-Operation
@@ -251,6 +255,7 @@ res = s.plex.get_pin(server_url="https://plex.tv/api/v2", x_plex_client_identifi
if res.object is not None:
# handle response
pass
```
<!-- End Server Selection [server] -->
@@ -295,6 +300,7 @@ res = s.server.get_server_capabilities()
if res.object is not None:
# handle response
pass
```
<!-- End Authentication [security] -->

View File

@@ -79,3 +79,13 @@ Based on:
- [python v0.3.1] .
### Releases
- [PyPI v0.3.1] https://pypi.org/project/plex-api-client/0.3.1 - .
## 2024-03-08 01:10:59
### Changes
Based on:
- OpenAPI Doc 0.0.3
- Speakeasy CLI 1.204.1 (2.279.1) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v0.4.0] .
### Releases
- [PyPI v0.4.0] https://pypi.org/project/plex-api-client/0.4.0 - .

View File

@@ -12,5 +12,6 @@ res = s.server.get_server_capabilities()
if res.object is not None:
# handle response
pass
```
<!-- End SDK Example Usage [usage] -->

View File

@@ -36,6 +36,7 @@ res = s.activities.get_server_activities()
if res.object is not None:
# handle response
pass
```
@@ -65,9 +66,10 @@ s = plex_api.PlexAPI(
res = s.activities.cancel_server_activities(activity_uuid='<value>')
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters

View File

@@ -29,9 +29,10 @@ s = plex_api.PlexAPI(
res = s.authentication.get_transient_token(type=operations.GetTransientTokenQueryParamType.DELEGATION, scope=operations.Scope.ALL)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -70,9 +71,10 @@ s = plex_api.PlexAPI(
res = s.authentication.get_source_connection_information(source='server://client-identifier')
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters

View File

@@ -33,6 +33,7 @@ res = s.butler.get_butler_tasks()
if res.object is not None:
# handle response
pass
```
@@ -67,9 +68,10 @@ s = plex_api.PlexAPI(
res = s.butler.start_all_tasks()
if res.status_code == 200:
if res is not None:
# handle response
pass
```
@@ -100,9 +102,10 @@ s = plex_api.PlexAPI(
res = s.butler.stop_all_tasks()
if res.status_code == 200:
if res is not None:
# handle response
pass
```
@@ -138,9 +141,10 @@ s = plex_api.PlexAPI(
res = s.butler.start_task(task_name=operations.TaskName.CLEAN_OLD_BUNDLES)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -178,9 +182,10 @@ s = plex_api.PlexAPI(
res = s.butler.stop_task(task_name=operations.PathParamTaskName.BACKUP_DATABASE)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters

View File

@@ -31,6 +31,7 @@ res = s.hubs.get_global_hubs(count=1262.49, only_transient=operations.OnlyTransi
if res.object is not None:
# handle response
pass
```
### Parameters
@@ -72,6 +73,7 @@ res = s.hubs.get_library_hubs(section_id=6728.76, count=9010.22, only_transient=
if res.object is not None:
# handle response
pass
```
### Parameters

View File

@@ -36,9 +36,10 @@ s = plex_api.PlexAPI(
res = s.library.get_file_hash(url='file://C:\Image.png&type=13', type=4462.17)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -79,6 +80,7 @@ res = s.library.get_recently_added()
if res.object is not None:
# handle response
pass
```
@@ -117,6 +119,7 @@ res = s.library.get_libraries()
if res.object is not None:
# handle response
pass
```
@@ -189,6 +192,7 @@ res = s.library.get_library(section_id=1000, include_details=operations.IncludeD
if res.object is not None:
# handle response
pass
```
### Parameters
@@ -225,9 +229,10 @@ s = plex_api.PlexAPI(
res = s.library.delete_library(section_id=1000)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -287,6 +292,7 @@ res = s.library.get_library_items(section_id=451092, tag=operations.Tag.UNWATCHE
if res.object is not None:
# handle response
pass
```
### Parameters
@@ -323,9 +329,10 @@ s = plex_api.PlexAPI(
res = s.library.refresh_library(section_id=934.16)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -383,6 +390,7 @@ res = s.library.search_library(section_id=933505, type=operations.Type.FOUR)
if res.object is not None:
# handle response
pass
```
### Parameters
@@ -422,6 +430,7 @@ res = s.library.get_metadata(rating_key=8382.31)
if res.object is not None:
# handle response
pass
```
### Parameters
@@ -461,6 +470,7 @@ res = s.library.get_metadata_children(rating_key=1539.14)
if res.object is not None:
# handle response
pass
```
### Parameters
@@ -500,6 +510,7 @@ res = s.library.get_on_deck()
if res.object is not None:
# handle response
pass
```

View File

@@ -30,9 +30,10 @@ s = plex_api.PlexAPI(
res = s.log.log_line(level=operations.Level.THREE, message='Test log message', source='Postman')
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -94,9 +95,10 @@ level=1&message=Test%20message%203&source=postman'
res = s.log.log_multi_line(req)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -133,9 +135,10 @@ s = plex_api.PlexAPI(
res = s.log.enable_paper_trail()
if res.status_code == 200:
if res is not None:
# handle response
pass
```

View File

@@ -28,9 +28,10 @@ s = plex_api.PlexAPI(
res = s.media.mark_played(key=59398)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -66,9 +67,10 @@ s = plex_api.PlexAPI(
res = s.media.mark_unplayed(key=59398)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -105,9 +107,10 @@ s = plex_api.PlexAPI(
res = s.media.update_play_progress(key='<value>', time=6900.91, state='<value>')
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters

View File

@@ -50,6 +50,7 @@ res = s.playlists.create_playlist(req)
if res.object is not None:
# handle response
pass
```
### Parameters
@@ -89,6 +90,7 @@ res = s.playlists.get_playlists(playlist_type=operations.PlaylistType.AUDIO, sma
if res.object is not None:
# handle response
pass
```
### Parameters
@@ -130,6 +132,7 @@ res = s.playlists.get_playlist(playlist_id=4109.48)
if res.object is not None:
# handle response
pass
```
### Parameters
@@ -166,9 +169,10 @@ s = plex_api.PlexAPI(
res = s.playlists.delete_playlist(playlist_id=216.22)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -205,9 +209,10 @@ s = plex_api.PlexAPI(
res = s.playlists.update_playlist(playlist_id=3915, title='<value>', summary='<value>')
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -252,6 +257,7 @@ res = s.playlists.get_playlist_contents(playlist_id=5004.46, type=9403.59)
if res.object is not None:
# handle response
pass
```
### Parameters
@@ -289,9 +295,10 @@ s = plex_api.PlexAPI(
res = s.playlists.clear_playlist_contents(playlist_id=1893.18)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -332,6 +339,7 @@ res = s.playlists.add_playlist_contents(playlist_id=8502.01, uri='server://12345
if res.object is not None:
# handle response
pass
```
### Parameters
@@ -371,9 +379,10 @@ s = plex_api.PlexAPI(
res = s.playlists.upload_playlist(path='/home/barkley/playlist.m3u', force=operations.Force.ZERO)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters

View File

@@ -28,6 +28,7 @@ res = s.plex.get_pin(x_plex_client_identifier='<value>', strong=False)
if res.object is not None:
# handle response
pass
```
### Parameters
@@ -63,9 +64,10 @@ s = plex_api.PlexAPI()
res = s.plex.get_token(pin_id='<value>', x_plex_client_identifier='<value>')
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters

View File

@@ -40,9 +40,10 @@ s = plex_api.PlexAPI(
res = s.search.perform_search(query='dylan', section_id=1516.53, limit=5)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -84,9 +85,10 @@ s = plex_api.PlexAPI(
res = s.search.perform_voice_search(query='dead+poop', section_id=4094.8, limit=5)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -127,6 +129,7 @@ res = s.search.get_search_results(query='110')
if res.object is not None:
# handle response
pass
```
### Parameters

View File

@@ -36,6 +36,7 @@ res = s.server.get_server_capabilities()
if res.object is not None:
# handle response
pass
```
@@ -68,6 +69,7 @@ res = s.server.get_server_preferences()
if res.object is not None:
# handle response
pass
```
@@ -100,6 +102,7 @@ res = s.server.get_available_clients()
if res.object is not None:
# handle response
pass
```
@@ -132,6 +135,7 @@ res = s.server.get_devices()
if res.object is not None:
# handle response
pass
```
@@ -164,6 +168,7 @@ res = s.server.get_server_identity()
if res.object is not None:
# handle response
pass
```
@@ -196,6 +201,7 @@ res = s.server.get_my_plex_account()
if res.object is not None:
# handle response
pass
```
@@ -236,9 +242,10 @@ req = operations.GetResizedPhotoRequest(
res = s.server.get_resized_photo(req)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -277,6 +284,7 @@ res = s.server.get_server_list()
if res.object is not None:
# handle response
pass
```

View File

@@ -32,6 +32,7 @@ res = s.sessions.get_sessions()
if res.object is not None:
# handle response
pass
```
@@ -64,6 +65,7 @@ res = s.sessions.get_session_history()
if res.object is not None:
# handle response
pass
```
@@ -96,6 +98,7 @@ res = s.sessions.get_transcode_sessions()
if res.object is not None:
# handle response
pass
```
@@ -125,9 +128,10 @@ s = plex_api.PlexAPI(
res = s.sessions.stop_transcode_session(session_key='zz7llzqlx8w9vnrsbnwhbmep')
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters

View File

@@ -29,6 +29,7 @@ res = s.statistics.get_statistics(timespan=411769)
if res.object is not None:
# handle response
pass
```
### Parameters

View File

@@ -32,6 +32,7 @@ res = s.updater.get_update_status()
if res.object is not None:
# handle response
pass
```
@@ -62,9 +63,10 @@ s = plex_api.PlexAPI(
res = s.updater.check_for_updates(download=operations.Download.ONE)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -102,9 +104,10 @@ s = plex_api.PlexAPI(
res = s.updater.apply_updates(tonight=operations.Tonight.ONE, skip=operations.Skip.ZERO)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters

View File

@@ -40,9 +40,10 @@ req = operations.GetTimelineRequest(
res = s.video.get_timeline(req)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters
@@ -86,9 +87,10 @@ req = operations.StartUniversalTranscodeRequest(
res = s.video.start_universal_transcode(req)
if res.status_code == 200:
if res is not None:
# handle response
pass
```
### Parameters

View File

@@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: false
python:
version: 0.3.1
version: 0.4.0
additionalDependencies:
dependencies: {}
extraDependencies:
@@ -33,3 +33,4 @@ python:
maxMethodParams: 4
outputModelSuffix: output
packageName: plex-api-client
responseFormat: envelope

1
py.typed Normal file
View File

@@ -0,0 +1 @@
# Marker file for PEP 561. The package enables type hints.

View File

@@ -10,7 +10,7 @@ except FileNotFoundError:
setuptools.setup(
name="plex-api-client",
version="0.3.1",
version="0.4.0",
author="LukeHagar",
description="Python Client SDK Generated by Speakeasy",
long_description=long_description,

View File

@@ -7,12 +7,11 @@ from typing import List, Optional, Tuple, Union
class SDKHooks(Hooks):
sdk_init_hooks: List[SDKInitHook] = []
before_request_hooks: List[BeforeRequestHook] = []
after_success_hooks: List[AfterSuccessHook] = []
after_error_hooks: List[AfterErrorHook] = []
def __init__(self):
self.sdk_init_hooks: List[SDKInitHook] = []
self.before_request_hooks: List[BeforeRequestHook] = []
self.after_success_hooks: List[AfterSuccessHook] = []
self.after_error_hooks: List[AfterErrorHook] = []
init_hooks(self)
def register_sdk_init_hook(self, hook: SDKInitHook) -> None:

View File

@@ -31,20 +31,20 @@ class Activities:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/activities'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -61,25 +61,28 @@ class Activities:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetServerActivitiesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetServerActivitiesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetServerActivitiesResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetServerActivitiesResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -97,20 +100,20 @@ class Activities:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.CancelServerActivitiesRequest, base_url, '/activities/{activityUUID}', request)
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('DELETE', url, headers=headers).prepare(),
requests_http.Request('DELETE', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -127,21 +130,23 @@ class Activities:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.CancelServerActivitiesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.CancelServerActivitiesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.CancelServerActivitiesResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res

View File

@@ -28,16 +28,16 @@ class Authentication:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/security/token'
headers = {}
query_params = utils.get_query_params(operations.GetTransientTokenRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.GetTransientTokenRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -59,21 +59,23 @@ class Authentication:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetTransientTokenResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetTransientTokenResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetTransientTokenResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -92,16 +94,16 @@ class Authentication:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/security/resources'
headers = {}
query_params = utils.get_query_params(operations.GetSourceConnectionInformationRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.GetSourceConnectionInformationRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -123,21 +125,23 @@ class Authentication:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetSourceConnectionInformationResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetSourceConnectionInformationResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetSourceConnectionInformationResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res

View File

@@ -24,20 +24,20 @@ class Butler:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/butler'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -54,25 +54,28 @@ class Butler:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetButlerTasksResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetButlerTasksResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetButlerTasksResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetButlerTasksResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -90,20 +93,20 @@ class Butler:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/butler'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('POST', url, headers=headers).prepare(),
requests_http.Request('POST', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -120,21 +123,23 @@ class Butler:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.StartAllTasksResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.StartAllTasksResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.StartAllTasksResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -148,20 +153,20 @@ class Butler:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/butler'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('DELETE', url, headers=headers).prepare(),
requests_http.Request('DELETE', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -178,21 +183,23 @@ class Butler:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.StopAllTasksResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.StopAllTasksResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.StopAllTasksResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -214,20 +221,20 @@ class Butler:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.StartTaskRequest, base_url, '/butler/{taskName}', request)
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('POST', url, headers=headers).prepare(),
requests_http.Request('POST', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -244,21 +251,23 @@ class Butler:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.StartTaskResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.StartTaskResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code in [200, 202]:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.StartTaskResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -276,20 +285,20 @@ class Butler:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.StopTaskRequest, base_url, '/butler/{taskName}', request)
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('DELETE', url, headers=headers).prepare(),
requests_http.Request('DELETE', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -306,21 +315,23 @@ class Butler:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.StopTaskResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.StopTaskResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code == 404 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.StopTaskResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res

View File

@@ -29,16 +29,16 @@ class Hubs:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/hubs'
headers = {}
query_params = utils.get_query_params(operations.GetGlobalHubsRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.GetGlobalHubsRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -60,25 +60,28 @@ class Hubs:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetGlobalHubsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetGlobalHubsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetGlobalHubsResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetGlobalHubsResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -98,16 +101,16 @@ class Hubs:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetLibraryHubsRequest, base_url, '/hubs/sections/{sectionId}', request)
headers = {}
query_params = utils.get_query_params(operations.GetLibraryHubsRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.GetLibraryHubsRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -129,25 +132,28 @@ class Hubs:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetLibraryHubsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetLibraryHubsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetLibraryHubsResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetLibraryHubsResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res

View File

@@ -29,16 +29,16 @@ class Library:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/library/hashes'
headers = {}
query_params = utils.get_query_params(operations.GetFileHashRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.GetFileHashRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -60,21 +60,23 @@ class Library:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetFileHashResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetFileHashResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetFileHashResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -88,20 +90,20 @@ class Library:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/library/recentlyAdded'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -118,25 +120,28 @@ class Library:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetRecentlyAddedResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetRecentlyAddedResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetRecentlyAddedResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetRecentlyAddedResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -155,20 +160,20 @@ class Library:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/library/sections'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -185,25 +190,28 @@ class Library:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetLibrariesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetLibrariesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetLibrariesResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetLibrariesResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -260,16 +268,16 @@ class Library:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetLibraryRequest, base_url, '/library/sections/{sectionId}', request)
headers = {}
query_params = utils.get_query_params(operations.GetLibraryRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.GetLibraryRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -291,25 +299,28 @@ class Library:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetLibraryResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetLibraryResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetLibraryResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetLibraryResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -327,20 +338,20 @@ class Library:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.DeleteLibraryRequest, base_url, '/library/sections/{sectionId}', request)
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('DELETE', url, headers=headers).prepare(),
requests_http.Request('DELETE', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -357,21 +368,23 @@ class Library:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.DeleteLibraryResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.DeleteLibraryResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.DeleteLibraryResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -409,20 +422,20 @@ class Library:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetLibraryItemsRequest, base_url, '/library/sections/{sectionId}/{tag}', request)
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -439,18 +452,20 @@ class Library:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetLibraryItemsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetLibraryItemsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetLibraryItemsResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -468,20 +483,20 @@ class Library:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.RefreshLibraryRequest, base_url, '/library/sections/{sectionId}/refresh', request)
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -498,21 +513,23 @@ class Library:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.RefreshLibraryResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.RefreshLibraryResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.RefreshLibraryResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -548,16 +565,16 @@ class Library:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.SearchLibraryRequest, base_url, '/library/sections/{sectionId}/search', request)
headers = {}
query_params = utils.get_query_params(operations.SearchLibraryRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.SearchLibraryRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -579,18 +596,20 @@ class Library:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.SearchLibraryResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.SearchLibraryResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.SearchLibraryResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -608,20 +627,20 @@ class Library:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetMetadataRequest, base_url, '/library/metadata/{ratingKey}', request)
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -638,25 +657,28 @@ class Library:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetMetadataResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetMetadataResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetMetadataResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetMetadataResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -674,20 +696,20 @@ class Library:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetMetadataChildrenRequest, base_url, '/library/metadata/{ratingKey}/children', request)
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -704,25 +726,28 @@ class Library:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetMetadataChildrenResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetMetadataChildrenResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetMetadataChildrenResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetMetadataChildrenResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -736,20 +761,20 @@ class Library:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/library/onDeck'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -766,25 +791,28 @@ class Library:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetOnDeckResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetOnDeckResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetOnDeckResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetOnDeckResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res

View File

@@ -29,16 +29,16 @@ class Log:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/log'
headers = {}
query_params = utils.get_query_params(operations.LogLineRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.LogLineRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -60,21 +60,23 @@ class Log:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.LogLineResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.LogLineResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.LogLineResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -108,7 +110,12 @@ class Log:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/log'
headers = {}
if callable(self.sdk_configuration.security):
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
headers, query_params = utils.get_security(self.sdk_configuration.security)
req_content_type, data, form = utils.serialize_request_body(request, str, "request", False, False, 'string')
if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
headers['content-type'] = req_content_type
@@ -116,17 +123,12 @@ class Log:
raise Exception('request body is required')
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('POST', url, data=data, files=form, headers=headers).prepare(),
requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -143,21 +145,23 @@ class Log:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.LogMultiLineResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.LogMultiLineResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.LogMultiLineResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -171,20 +175,20 @@ class Log:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/log/networked'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -201,21 +205,23 @@ class Log:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.EnablePaperTrailResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.EnablePaperTrailResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code == 403 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.EnablePaperTrailResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res

View File

@@ -27,16 +27,16 @@ class Media:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/:/scrobble'
headers = {}
query_params = utils.get_query_params(operations.MarkPlayedRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.MarkPlayedRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -58,21 +58,23 @@ class Media:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.MarkPlayedResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.MarkPlayedResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.MarkPlayedResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -90,16 +92,16 @@ class Media:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/:/unscrobble'
headers = {}
query_params = utils.get_query_params(operations.MarkUnplayedRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.MarkUnplayedRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -121,21 +123,23 @@ class Media:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.MarkUnplayedResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.MarkUnplayedResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.MarkUnplayedResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -155,16 +159,16 @@ class Media:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/:/progress'
headers = {}
query_params = utils.get_query_params(operations.UpdatePlayProgressRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.UpdatePlayProgressRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -186,21 +190,23 @@ class Media:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.UpdatePlayProgressResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.UpdatePlayProgressResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.UpdatePlayProgressResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res

View File

@@ -30,16 +30,16 @@ class Playlists:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/playlists'
headers = {}
query_params = utils.get_query_params(operations.CreatePlaylistRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.CreatePlaylistRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -61,25 +61,28 @@ class Playlists:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.CreatePlaylistResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.CreatePlaylistResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.CreatePlaylistResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.CreatePlaylistResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -98,16 +101,16 @@ class Playlists:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/playlists'
headers = {}
query_params = utils.get_query_params(operations.GetPlaylistsRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.GetPlaylistsRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -129,25 +132,28 @@ class Playlists:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetPlaylistsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetPlaylistsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetPlaylistsResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetPlaylistsResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -166,20 +172,20 @@ class Playlists:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetPlaylistRequest, base_url, '/playlists/{playlistID}', request)
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -196,25 +202,28 @@ class Playlists:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetPlaylistResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetPlaylistResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetPlaylistResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetPlaylistResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -232,20 +241,20 @@ class Playlists:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.DeletePlaylistRequest, base_url, '/playlists/{playlistID}', request)
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('DELETE', url, headers=headers).prepare(),
requests_http.Request('DELETE', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -262,21 +271,23 @@ class Playlists:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.DeletePlaylistResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.DeletePlaylistResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.DeletePlaylistResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -296,16 +307,16 @@ class Playlists:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.UpdatePlaylistRequest, base_url, '/playlists/{playlistID}', request)
headers = {}
query_params = utils.get_query_params(operations.UpdatePlaylistRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.UpdatePlaylistRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -327,21 +338,23 @@ class Playlists:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.UpdatePlaylistResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.UpdatePlaylistResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.UpdatePlaylistResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -363,16 +376,16 @@ class Playlists:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetPlaylistContentsRequest, base_url, '/playlists/{playlistID}/items', request)
headers = {}
query_params = utils.get_query_params(operations.GetPlaylistContentsRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.GetPlaylistContentsRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -394,25 +407,28 @@ class Playlists:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetPlaylistContentsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetPlaylistContentsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetPlaylistContentsResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetPlaylistContentsResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -430,20 +446,20 @@ class Playlists:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.ClearPlaylistContentsRequest, base_url, '/playlists/{playlistID}/items', request)
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('DELETE', url, headers=headers).prepare(),
requests_http.Request('DELETE', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -460,21 +476,23 @@ class Playlists:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.ClearPlaylistContentsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.ClearPlaylistContentsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ClearPlaylistContentsResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -495,16 +513,16 @@ class Playlists:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.AddPlaylistContentsRequest, base_url, '/playlists/{playlistID}/items', request)
headers = {}
query_params = utils.get_query_params(operations.AddPlaylistContentsRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.AddPlaylistContentsRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -526,25 +544,28 @@ class Playlists:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.AddPlaylistContentsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.AddPlaylistContentsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.AddPlaylistContentsResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.AddPlaylistContentsResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -563,16 +584,16 @@ class Playlists:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/playlists/upload'
headers = {}
query_params = utils.get_query_params(operations.UploadPlaylistRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.UploadPlaylistRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -594,21 +615,23 @@ class Playlists:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.UploadPlaylistResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.UploadPlaylistResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.UploadPlaylistResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res

View File

@@ -32,14 +32,16 @@ class Plex:
base_url = server_url
url = base_url + '/pins'
headers = utils.get_headers(request)
query_params = utils.get_query_params(operations.GetPinRequest, request)
headers = {}
query_params = {}
headers = { **utils.get_headers(request), **headers }
query_params = { **utils.get_query_params(operations.GetPinRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
@@ -60,25 +62,28 @@ class Plex:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetPinResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetPinResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetPinResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetPinResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -100,13 +105,14 @@ class Plex:
base_url = server_url
url = utils.generate_url(operations.GetTokenRequest, base_url, '/pins/{pinID}', request)
headers = utils.get_headers(request)
headers = {}
headers = { **utils.get_headers(request), **headers }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
@@ -127,21 +133,23 @@ class Plex:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetTokenResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetTokenResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetTokenResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res

View File

@@ -32,9 +32,9 @@ class SDKConfiguration:
server_defaults: List[Dict[str, str]] = field(default_factory=List)
language: str = 'python'
openapi_doc_version: str = '0.0.3'
sdk_version: str = '0.3.1'
gen_version: str = '2.277.0'
user_agent: str = 'speakeasy-sdk/python 0.3.1 2.277.0 0.0.3 plex-api-client'
sdk_version: str = '0.4.0'
gen_version: str = '2.279.1'
user_agent: str = 'speakeasy-sdk/python 0.4.0 2.279.1 0.0.3 plex-api-client'
retry_config: RetryConfig = None
_hooks: SDKHooks = None

View File

@@ -41,16 +41,16 @@ class Search:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/hubs/search'
headers = {}
query_params = utils.get_query_params(operations.PerformSearchRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.PerformSearchRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -72,21 +72,23 @@ class Search:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.PerformSearchResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.PerformSearchResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.PerformSearchResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -109,16 +111,16 @@ class Search:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/hubs/search/voice'
headers = {}
query_params = utils.get_query_params(operations.PerformVoiceSearchRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.PerformVoiceSearchRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -140,21 +142,23 @@ class Search:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.PerformVoiceSearchResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.PerformVoiceSearchResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.PerformVoiceSearchResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -172,16 +176,16 @@ class Search:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/search'
headers = {}
query_params = utils.get_query_params(operations.GetSearchResultsRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.GetSearchResultsRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -203,25 +207,28 @@ class Search:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetSearchResultsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetSearchResultsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetSearchResultsResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetSearchResultsResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res

View File

@@ -24,388 +24,15 @@ class Server:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
raise e
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
if e:
raise e
else:
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
if isinstance(result, Exception):
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetServerCapabilitiesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetServerCapabilitiesResponseBody])
res.object = out
else:
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetServerCapabilitiesResponseBody)
out.raw_response = http_res
raise out
else:
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
return res
def get_server_preferences(self) -> operations.GetServerPreferencesResponse:
r"""Get Server Preferences
Get Server Preferences
"""
hook_ctx = HookContext(operation_id='getServerPreferences', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/:/prefs'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
raise e
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
if e:
raise e
else:
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
if isinstance(result, Exception):
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetServerPreferencesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetServerPreferencesResponseBody])
res.object = out
else:
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetServerPreferencesResponseBody)
out.raw_response = http_res
raise out
else:
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
return res
def get_available_clients(self) -> operations.GetAvailableClientsResponse:
r"""Get Available Clients
Get Available Clients
"""
hook_ctx = HookContext(operation_id='getAvailableClients', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/clients'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
raise e
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
if e:
raise e
else:
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
if isinstance(result, Exception):
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetAvailableClientsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetAvailableClientsResponseBody])
res.object = out
else:
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetAvailableClientsResponseBody)
out.raw_response = http_res
raise out
else:
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
return res
def get_devices(self) -> operations.GetDevicesResponse:
r"""Get Devices
Get Devices
"""
hook_ctx = HookContext(operation_id='getDevices', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/devices'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
raise e
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
if e:
raise e
else:
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
if isinstance(result, Exception):
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetDevicesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetDevicesResponseBody])
res.object = out
else:
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetDevicesResponseBody)
out.raw_response = http_res
raise out
else:
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
return res
def get_server_identity(self) -> operations.GetServerIdentityResponse:
r"""Get Server Identity
Get Server Identity
"""
hook_ctx = HookContext(operation_id='getServerIdentity', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/identity'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
raise e
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
if e:
raise e
else:
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
if isinstance(result, Exception):
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetServerIdentityResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetServerIdentityResponseBody])
res.object = out
else:
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetServerIdentityResponseBody)
out.raw_response = http_res
raise out
else:
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
return res
def get_my_plex_account(self) -> operations.GetMyPlexAccountResponse:
r"""Get MyPlex Account
Returns MyPlex Account Information
"""
hook_ctx = HookContext(operation_id='getMyPlexAccount', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/myplex/account'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
raise e
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
if e:
raise e
else:
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
if isinstance(result, Exception):
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetMyPlexAccountResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetMyPlexAccountResponseBody])
res.object = out
else:
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetMyPlexAccountResponseBody)
out.raw_response = http_res
raise out
else:
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
return res
def get_resized_photo(self, request: operations.GetResizedPhotoRequest) -> operations.GetResizedPhotoResponse:
r"""Get a Resized Photo
Plex's Photo transcoder is used throughout the service to serve images at specified sizes.
"""
hook_ctx = HookContext(operation_id='getResizedPhoto', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/photo/:/transcode'
headers = {}
query_params = utils.get_query_params(operations.GetResizedPhotoRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -427,48 +54,55 @@ class Server:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetResizedPhotoResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetServerCapabilitiesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetServerCapabilitiesResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetResizedPhotoResponseBody)
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetServerCapabilitiesResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
def get_server_list(self) -> operations.GetServerListResponse:
r"""Get Server List
Get Server List
def get_server_preferences(self) -> operations.GetServerPreferencesResponse:
r"""Get Server Preferences
Get Server Preferences
"""
hook_ctx = HookContext(operation_id='getServerList', oauth2_scopes=[], security_source=self.sdk_configuration.security)
hook_ctx = HookContext(operation_id='getServerPreferences', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/servers'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
url = base_url + '/:/prefs'
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -485,25 +119,414 @@ class Server:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetServerListResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetServerPreferencesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetServerListResponseBody])
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetServerPreferencesResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetServerListResponseBody)
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetServerPreferencesResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
def get_available_clients(self) -> operations.GetAvailableClientsResponse:
r"""Get Available Clients
Get Available Clients
"""
hook_ctx = HookContext(operation_id='getAvailableClients', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/clients'
if callable(self.sdk_configuration.security):
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
raise e
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
if e:
raise e
else:
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
if isinstance(result, Exception):
raise result
http_res = result
res = operations.GetAvailableClientsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetAvailableClientsResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetAvailableClientsResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
def get_devices(self) -> operations.GetDevicesResponse:
r"""Get Devices
Get Devices
"""
hook_ctx = HookContext(operation_id='getDevices', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/devices'
if callable(self.sdk_configuration.security):
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
raise e
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
if e:
raise e
else:
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
if isinstance(result, Exception):
raise result
http_res = result
res = operations.GetDevicesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetDevicesResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetDevicesResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
def get_server_identity(self) -> operations.GetServerIdentityResponse:
r"""Get Server Identity
Get Server Identity
"""
hook_ctx = HookContext(operation_id='getServerIdentity', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/identity'
if callable(self.sdk_configuration.security):
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
raise e
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
if e:
raise e
else:
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
if isinstance(result, Exception):
raise result
http_res = result
res = operations.GetServerIdentityResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetServerIdentityResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetServerIdentityResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
def get_my_plex_account(self) -> operations.GetMyPlexAccountResponse:
r"""Get MyPlex Account
Returns MyPlex Account Information
"""
hook_ctx = HookContext(operation_id='getMyPlexAccount', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/myplex/account'
if callable(self.sdk_configuration.security):
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
raise e
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
if e:
raise e
else:
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
if isinstance(result, Exception):
raise result
http_res = result
res = operations.GetMyPlexAccountResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetMyPlexAccountResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetMyPlexAccountResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
def get_resized_photo(self, request: operations.GetResizedPhotoRequest) -> operations.GetResizedPhotoResponse:
r"""Get a Resized Photo
Plex's Photo transcoder is used throughout the service to serve images at specified sizes.
"""
hook_ctx = HookContext(operation_id='getResizedPhoto', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/photo/:/transcode'
if callable(self.sdk_configuration.security):
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.GetResizedPhotoRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
raise e
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
if e:
raise e
else:
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
if isinstance(result, Exception):
raise result
http_res = result
res = operations.GetResizedPhotoResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetResizedPhotoResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
def get_server_list(self) -> operations.GetServerListResponse:
r"""Get Server List
Get Server List
"""
hook_ctx = HookContext(operation_id='getServerList', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/servers'
if callable(self.sdk_configuration.security):
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
raise e
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
if e:
raise e
else:
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
if isinstance(result, Exception):
raise result
http_res = result
res = operations.GetServerListResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetServerListResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetServerListResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res

View File

@@ -24,20 +24,20 @@ class Sessions:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/status/sessions'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -54,25 +54,28 @@ class Sessions:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetSessionsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetSessionsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetSessionsResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetSessionsResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -86,20 +89,20 @@ class Sessions:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/status/sessions/history/all'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -116,25 +119,28 @@ class Sessions:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetSessionHistoryResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetSessionHistoryResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetSessionHistoryResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetSessionHistoryResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -148,20 +154,20 @@ class Sessions:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/transcode/sessions'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -178,25 +184,28 @@ class Sessions:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetTranscodeSessionsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetTranscodeSessionsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetTranscodeSessionsResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetTranscodeSessionsResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -214,20 +223,20 @@ class Sessions:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.StopTranscodeSessionRequest, base_url, '/transcode/sessions/{sessionKey}', request)
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('DELETE', url, headers=headers).prepare(),
requests_http.Request('DELETE', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -244,21 +253,23 @@ class Sessions:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.StopTranscodeSessionResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.StopTranscodeSessionResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 204:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.StopTranscodeSessionResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res

View File

@@ -28,16 +28,16 @@ class Statistics:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/statistics/media'
headers = {}
query_params = utils.get_query_params(operations.GetStatisticsRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.GetStatisticsRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -59,25 +59,28 @@ class Statistics:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetStatisticsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetStatisticsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetStatisticsResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetStatisticsResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res

View File

@@ -26,20 +26,20 @@ class Updater:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/updater/status'
headers = {}
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
hook_ctx,
requests_http.Request('GET', url, headers=headers).prepare(),
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
)
http_res = client.send(req)
except Exception as e:
@@ -56,25 +56,28 @@ class Updater:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetUpdateStatusResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetUpdateStatusResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GetUpdateStatusResponseBody])
res.object = out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetUpdateStatusResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -92,16 +95,16 @@ class Updater:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/updater/check'
headers = {}
query_params = utils.get_query_params(operations.CheckForUpdatesRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.CheckForUpdatesRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -123,21 +126,23 @@ class Updater:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.CheckForUpdatesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.CheckForUpdatesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.CheckForUpdatesResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -156,16 +161,16 @@ class Updater:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/updater/apply'
headers = {}
query_params = utils.get_query_params(operations.ApplyUpdatesRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.ApplyUpdatesRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -187,21 +192,23 @@ class Updater:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.ApplyUpdatesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.ApplyUpdatesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code == 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ApplyUpdatesResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res

View File

@@ -4,7 +4,7 @@ import base64
import json
import re
import sys
from dataclasses import Field, dataclass, fields, is_dataclass, make_dataclass
from dataclasses import Field, fields, is_dataclass, make_dataclass
from datetime import date, datetime
from decimal import Decimal
from email.message import Message
@@ -14,30 +14,15 @@ from typing import (Any, Callable, Dict, List, Optional, Tuple, Union,
from xmlrpc.client import boolean
from typing_inspect import is_optional_type
import dateutil.parser
import requests
from dataclasses_json import DataClassJsonMixin
class SecurityClient:
client: requests.Session
query_params: Dict[str, str] = {}
def get_security(security: Any) -> Tuple[Dict[str, str], Dict[str, str]]:
headers: Dict[str, str] = {}
def __init__(self, client: requests.Session):
self.client = client
def send(self, request: requests.PreparedRequest, **kwargs):
request.prepare_url(url=request.url, params=self.query_params)
request.headers.update(self.headers)
return self.client.send(request, **kwargs)
def configure_security_client(client: requests.Session, security: dataclass):
client = SecurityClient(client)
query_params: Dict[str, str] = {}
if security is None:
return client
return headers, query_params
sec_fields: Tuple[Field, ...] = fields(security)
for sec_field in sec_fields:
@@ -49,35 +34,35 @@ def configure_security_client(client: requests.Session, security: dataclass):
if metadata is None:
continue
if metadata.get('option'):
_parse_security_option(client, value)
return client
_parse_security_option(headers, query_params, value)
return headers, query_params
if metadata.get('scheme'):
# Special case for basic auth which could be a flattened struct
if metadata.get("sub_type") == "basic" and not is_dataclass(value):
_parse_security_scheme(client, metadata, security)
_parse_security_scheme(headers, query_params, metadata, security)
else:
_parse_security_scheme(client, metadata, value)
_parse_security_scheme(headers, query_params, metadata, value)
return client
return headers, query_params
def _parse_security_option(client: SecurityClient, option: dataclass):
def _parse_security_option(headers: Dict[str, str], query_params: Dict[str, str], option: Any):
opt_fields: Tuple[Field, ...] = fields(option)
for opt_field in opt_fields:
metadata = opt_field.metadata.get('security')
if metadata is None or metadata.get('scheme') is None:
continue
_parse_security_scheme(
client, metadata, getattr(option, opt_field.name))
headers, query_params, metadata, getattr(option, opt_field.name))
def _parse_security_scheme(client: SecurityClient, scheme_metadata: Dict, scheme: any):
def _parse_security_scheme(headers: Dict[str, str], query_params: Dict[str, str], scheme_metadata: Dict, scheme: Any):
scheme_type = scheme_metadata.get('type')
sub_type = scheme_metadata.get('sub_type')
if is_dataclass(scheme):
if scheme_type == 'http' and sub_type == 'basic':
_parse_basic_auth_scheme(client, scheme)
_parse_basic_auth_scheme(headers, scheme)
return
scheme_fields: Tuple[Field, ...] = fields(scheme)
@@ -89,33 +74,33 @@ def _parse_security_scheme(client: SecurityClient, scheme_metadata: Dict, scheme
value = getattr(scheme, scheme_field.name)
_parse_security_scheme_value(
client, scheme_metadata, metadata, value)
headers, query_params, scheme_metadata, metadata, value)
else:
_parse_security_scheme_value(
client, scheme_metadata, scheme_metadata, scheme)
headers, query_params, scheme_metadata, scheme_metadata, scheme)
def _parse_security_scheme_value(client: SecurityClient, scheme_metadata: Dict, security_metadata: Dict, value: any):
def _parse_security_scheme_value(headers: Dict[str, str], query_params: Dict[str, str], scheme_metadata: Dict, security_metadata: Dict, value: Any):
scheme_type = scheme_metadata.get('type')
sub_type = scheme_metadata.get('sub_type')
header_name = security_metadata.get('field_name')
header_name = str(security_metadata.get('field_name'))
if scheme_type == "apiKey":
if sub_type == 'header':
client.headers[header_name] = value
headers[header_name] = value
elif sub_type == 'query':
client.query_params[header_name] = value
query_params[header_name] = value
else:
raise Exception('not supported')
elif scheme_type == "openIdConnect":
client.headers[header_name] = _apply_bearer(value)
headers[header_name] = _apply_bearer(value)
elif scheme_type == 'oauth2':
if sub_type != 'client_credentials':
client.headers[header_name] = _apply_bearer(value)
headers[header_name] = _apply_bearer(value)
elif scheme_type == 'http':
if sub_type == 'bearer':
client.headers[header_name] = _apply_bearer(value)
headers[header_name] = _apply_bearer(value)
else:
raise Exception('not supported')
else:
@@ -126,7 +111,7 @@ def _apply_bearer(token: str) -> str:
return token.lower().startswith('bearer ') and token or f'Bearer {token}'
def _parse_basic_auth_scheme(client: SecurityClient, scheme: dataclass):
def _parse_basic_auth_scheme(headers: Dict[str, str], scheme: Any):
username = ""
password = ""
@@ -145,11 +130,11 @@ def _parse_basic_auth_scheme(client: SecurityClient, scheme: dataclass):
password = value
data = f'{username}:{password}'.encode()
client.headers['Authorization'] = f'Basic {base64.b64encode(data).decode()}'
headers['Authorization'] = f'Basic {base64.b64encode(data).decode()}'
def generate_url(clazz: type, server_url: str, path: str, path_params: dataclass,
gbls: Dict[str, Dict[str, Dict[str, Any]]] = None) -> str:
def generate_url(clazz: type, server_url: str, path: str, path_params: Any,
gbls: Optional[Dict[str, Dict[str, Dict[str, Any]]]] = None) -> str:
path_param_fields: Tuple[Field, ...] = fields(clazz)
for field in path_param_fields:
request_metadata = field.metadata.get('request')
@@ -241,7 +226,7 @@ def template_url(url_with_params: str, params: Dict[str, str]) -> str:
return url_with_params
def get_query_params(clazz: type, query_params: dataclass, gbls: Dict[str, Dict[str, Dict[str, Any]]] = None) -> Dict[
def get_query_params(clazz: type, query_params: Any, gbls: Optional[Dict[str, Dict[str, Dict[str, Any]]]] = None) -> Dict[
str, List[str]]:
params: Dict[str, List[str]] = {}
@@ -287,7 +272,7 @@ def get_query_params(clazz: type, query_params: dataclass, gbls: Dict[str, Dict[
return params
def get_headers(headers_params: dataclass) -> Dict[str, str]:
def get_headers(headers_params: Any) -> Dict[str, str]:
if headers_params is None:
return {}
@@ -308,7 +293,7 @@ def get_headers(headers_params: dataclass) -> Dict[str, str]:
return headers
def _get_serialized_params(metadata: Dict, field_type: type, field_name: str, obj: any) -> Dict[str, str]:
def _get_serialized_params(metadata: Dict, field_type: type, field_name: str, obj: Any) -> Dict[str, str]:
params: Dict[str, str] = {}
serialization = metadata.get('serialization', '')
@@ -319,7 +304,7 @@ def _get_serialized_params(metadata: Dict, field_type: type, field_name: str, ob
return params
def _get_deep_object_query_params(metadata: Dict, field_name: str, obj: any) -> Dict[str, List[str]]:
def _get_deep_object_query_params(metadata: Dict, field_name: str, obj: Any) -> Dict[str, List[str]]:
params: Dict[str, List[str]] = {}
if obj is None:
@@ -385,7 +370,7 @@ def _get_query_param_field_name(obj_field: Field) -> str:
return obj_param_metadata.get("field_name", obj_field.name)
def _get_delimited_query_params(metadata: Dict, field_name: str, obj: any, delimiter: str) -> Dict[
def _get_delimited_query_params(metadata: Dict, field_name: str, obj: Any, delimiter: str) -> Dict[
str, List[str]]:
return _populate_form(field_name, metadata.get("explode", True), obj, _get_query_param_field_name, delimiter)
@@ -399,8 +384,8 @@ SERIALIZATION_METHOD_TO_CONTENT_TYPE = {
}
def serialize_request_body(request: dataclass, request_type: type, request_field_name: str, nullable: bool, optional: bool, serialization_method: str, encoder=None) -> Tuple[
str, any, any]:
def serialize_request_body(request: Any, request_type: type, request_field_name: str, nullable: bool, optional: bool, serialization_method: str, encoder=None) -> Tuple[
Optional[str], Optional[Any], Optional[Any]]:
if request is None:
if not nullable and optional:
return None, None, None
@@ -430,7 +415,7 @@ def serialize_request_body(request: dataclass, request_type: type, request_field
request_val)
def serialize_content_type(field_name: str, request_type: any, media_type: str, request: dataclass, encoder=None) -> Tuple[str, any, List[List[any]]]:
def serialize_content_type(field_name: str, request_type: Any, media_type: str, request: Any, encoder=None) -> Tuple[Optional[str], Optional[Any], Optional[List[List[Any]]]]:
if re.match(r'(application|text)\/.*?\+*json.*', media_type) is not None:
return media_type, marshal_json(request, request_type, encoder), None
if re.match(r'multipart\/.*', media_type) is not None:
@@ -446,8 +431,8 @@ def serialize_content_type(field_name: str, request_type: any, media_type: str,
f"invalid request body type {type(request)} for mediaType {media_type}")
def serialize_multipart_form(media_type: str, request: dataclass) -> Tuple[str, any, List[List[any]]]:
form: List[List[any]] = []
def serialize_multipart_form(media_type: str, request: Any) -> Tuple[str, Any, List[List[Any]]]:
form: List[List[Any]] = []
request_fields = fields(request)
for field in request_fields:
@@ -502,7 +487,7 @@ def serialize_multipart_form(media_type: str, request: dataclass) -> Tuple[str,
def serialize_dict(original: Dict, explode: bool, field_name, existing: Optional[Dict[str, List[str]]]) -> Dict[
str, List[str]]:
if existing is None:
existing = []
existing = {}
if explode is True:
for key, val in original.items():
@@ -520,7 +505,7 @@ def serialize_dict(original: Dict, explode: bool, field_name, existing: Optional
return existing
def serialize_form_data(field_name: str, data: dataclass) -> Dict[str, any]:
def serialize_form_data(field_name: str, data: Any) -> Dict[str, Any]:
form: Dict[str, List[str]] = {}
if is_dataclass(data):
@@ -562,7 +547,7 @@ def _get_form_field_name(obj_field: Field) -> str:
return obj_param_metadata.get("field_name", obj_field.name)
def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_func: Callable, delimiter: str) -> \
def _populate_form(field_name: str, explode: boolean, obj: Any, get_field_name_func: Callable, delimiter: str) -> \
Dict[str, List[str]]:
params: Dict[str, List[str]] = {}
@@ -597,7 +582,7 @@ def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_f
continue
if explode:
params[key] = _val_to_string(value)
params[key] = [_val_to_string(value)]
else:
items.append(f'{key}{delimiter}{_val_to_string(value)}')
@@ -626,7 +611,7 @@ def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_f
return params
def _serialize_header(explode: bool, obj: any) -> str:
def _serialize_header(explode: bool, obj: Any) -> str:
if obj is None:
return ''
@@ -850,7 +835,7 @@ def list_decoder(value_decoder: Callable):
def union_encoder(all_encoders: Dict[str, Callable]):
def selective_encoder(val: any):
def selective_encoder(val: Any):
if type(val) in all_encoders:
return all_encoders[type(val)](val)
return val
@@ -858,7 +843,7 @@ def union_encoder(all_encoders: Dict[str, Callable]):
def union_decoder(all_decoders: List[Callable]):
def selective_decoder(val: any):
def selective_decoder(val: Any):
decoded = val
for decoder in all_decoders:
try:
@@ -877,18 +862,18 @@ def get_field_name(name):
return override
def _val_to_string(val):
def _val_to_string(val) -> str:
if isinstance(val, bool):
return str(val).lower()
if isinstance(val, datetime):
return val.isoformat().replace('+00:00', 'Z')
return str(val.isoformat().replace('+00:00', 'Z'))
if isinstance(val, Enum):
return str(val.value)
return str(val)
def _populate_from_globals(param_name: str, value: any, param_type: str, gbls: Dict[str, Dict[str, Dict[str, Any]]]):
def _populate_from_globals(param_name: str, value: Any, param_type: str, gbls: Optional[Dict[str, Dict[str, Dict[str, Any]]]]):
if value is None and gbls is not None:
if 'parameters' in gbls:
if param_type in gbls['parameters']:

View File

@@ -23,16 +23,16 @@ class Video:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/:/timeline'
headers = {}
query_params = utils.get_query_params(operations.GetTimelineRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.GetTimelineRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -54,21 +54,23 @@ class Video:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.GetTimelineResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.GetTimelineResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.GetTimelineResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -82,16 +84,16 @@ class Video:
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/video/:/transcode/universal/start.mpd'
headers = {}
query_params = utils.get_query_params(operations.StartUniversalTranscodeRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
headers, query_params = utils.get_security(self.sdk_configuration.security)
query_params = { **utils.get_query_params(operations.StartUniversalTranscodeRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
client = self.sdk_configuration.client
try:
req = self.sdk_configuration.get_hooks().before_request(
@@ -113,21 +115,23 @@ class Video:
raise result
http_res = result
content_type = http_res.headers.get('Content-Type')
res = operations.StartUniversalTranscodeResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
res = operations.StartUniversalTranscodeResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code == 401:
if utils.match_content_type(content_type, 'application/json'):
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.StartUniversalTranscodeResponseBody)
out.raw_response = http_res
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res