Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion jellyfish/_openapi_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@
from jellyfish._openapi_client.models.component_details_response import (
ComponentDetailsResponse,
)
from jellyfish._openapi_client.models.component_file import ComponentFile
from jellyfish._openapi_client.models.component_hls import ComponentHLS
from jellyfish._openapi_client.models.component_metadata_hls import ComponentMetadataHLS
from jellyfish._openapi_client.models.component_options import ComponentOptions
from jellyfish._openapi_client.models.component_options_file import ComponentOptionsFile
from jellyfish._openapi_client.models.component_options_hls import ComponentOptionsHLS
from jellyfish._openapi_client.models.component_options_hlss3 import (
ComponentOptionsHLSS3,
)
from jellyfish._openapi_client.models.component_options_rtsp import ComponentOptionsRTSP
from jellyfish._openapi_client.models.component_properties_hls import (
ComponentPropertiesHLS,
)
from jellyfish._openapi_client.models.component_rtsp import ComponentRTSP
from jellyfish._openapi_client.models.error import Error
from jellyfish._openapi_client.models.hls_skip import HlsSkip
Expand Down
19 changes: 10 additions & 9 deletions jellyfish/_openapi_client/api/hls_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ def get_hls_content_with_http_info(

_response_types_map = {
"200": "str",
"400": "Error",
"404": "Error",
}

Expand All @@ -267,20 +268,20 @@ def get_hls_content_with_http_info(
)

@validate_arguments
def subscribe_tracks(
def subscribe_hls_to(
self,
room_id: Annotated[StrictStr, Field(..., description="Room ID")],
subscription_config: Annotated[
Optional[SubscriptionConfig], Field(description="Subscribe configuration")
] = None,
**kwargs
) -> None: # noqa: E501
"""Subscribe hls component for tracks # noqa: E501
"""Subscribe the HLS component to the tracks of peers or components # noqa: E501

This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True

>>> thread = api.subscribe_tracks(room_id, subscription_config, async_req=True)
>>> thread = api.subscribe_hls_to(room_id, subscription_config, async_req=True)
>>> result = thread.get()

:param room_id: Room ID (required)
Expand All @@ -301,27 +302,27 @@ def subscribe_tracks(
kwargs["_return_http_data_only"] = True
if "_preload_content" in kwargs:
raise ValueError(
"Error! Please call the subscribe_tracks_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"
"Error! Please call the subscribe_hls_to_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"
)
return self.subscribe_tracks_with_http_info(
return self.subscribe_hls_to_with_http_info(
room_id, subscription_config, **kwargs
) # noqa: E501

@validate_arguments
def subscribe_tracks_with_http_info(
def subscribe_hls_to_with_http_info(
self,
room_id: Annotated[StrictStr, Field(..., description="Room ID")],
subscription_config: Annotated[
Optional[SubscriptionConfig], Field(description="Subscribe configuration")
] = None,
**kwargs
) -> ApiResponse: # noqa: E501
"""Subscribe hls component for tracks # noqa: E501
"""Subscribe the HLS component to the tracks of peers or components # noqa: E501

This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True

>>> thread = api.subscribe_tracks_with_http_info(room_id, subscription_config, async_req=True)
>>> thread = api.subscribe_hls_to_with_http_info(room_id, subscription_config, async_req=True)
>>> result = thread.get()

:param room_id: Room ID (required)
Expand Down Expand Up @@ -373,7 +374,7 @@ def subscribe_tracks_with_http_info(
if _key not in _all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method subscribe_tracks" % _key
" to method subscribe_hls_to" % _key
)
_params[_key] = _val
del _params["kwargs"]
Expand Down
1 change: 1 addition & 0 deletions jellyfish/_openapi_client/api/recording_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ def get_recording_content_with_http_info(

_response_types_map = {
"200": "str",
"400": "Error",
"404": "Error",
}

Expand Down
6 changes: 5 additions & 1 deletion jellyfish/_openapi_client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@
from jellyfish._openapi_client.models.component_details_response import (
ComponentDetailsResponse,
)
from jellyfish._openapi_client.models.component_file import ComponentFile
from jellyfish._openapi_client.models.component_hls import ComponentHLS
from jellyfish._openapi_client.models.component_metadata_hls import ComponentMetadataHLS
from jellyfish._openapi_client.models.component_options import ComponentOptions
from jellyfish._openapi_client.models.component_options_file import ComponentOptionsFile
from jellyfish._openapi_client.models.component_options_hls import ComponentOptionsHLS
from jellyfish._openapi_client.models.component_options_hlss3 import (
ComponentOptionsHLSS3,
)
from jellyfish._openapi_client.models.component_options_rtsp import ComponentOptionsRTSP
from jellyfish._openapi_client.models.component_properties_hls import (
ComponentPropertiesHLS,
)
from jellyfish._openapi_client.models.component_rtsp import ComponentRTSP
from jellyfish._openapi_client.models.error import Error
from jellyfish._openapi_client.models.hls_skip import HlsSkip
Expand Down
38 changes: 32 additions & 6 deletions jellyfish/_openapi_client/models/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@

from typing import Any, List, Optional
from pydantic import BaseModel, Field, StrictStr, ValidationError, validator
from jellyfish._openapi_client.models.component_file import ComponentFile
from jellyfish._openapi_client.models.component_hls import ComponentHLS
from jellyfish._openapi_client.models.component_rtsp import ComponentRTSP
from typing import Union, Any, List, TYPE_CHECKING
from pydantic import StrictStr, Field

COMPONENT_ONE_OF_SCHEMAS = ["ComponentHLS", "ComponentRTSP"]
COMPONENT_ONE_OF_SCHEMAS = ["ComponentFile", "ComponentHLS", "ComponentRTSP"]


class Component(BaseModel):
Expand All @@ -35,8 +36,10 @@ class Component(BaseModel):
oneof_schema_1_validator: Optional[ComponentHLS] = None
# data type: ComponentRTSP
oneof_schema_2_validator: Optional[ComponentRTSP] = None
# data type: ComponentFile
oneof_schema_3_validator: Optional[ComponentFile] = None
if TYPE_CHECKING:
actual_instance: Union[ComponentHLS, ComponentRTSP]
actual_instance: Union[ComponentFile, ComponentHLS, ComponentRTSP]
else:
actual_instance: Any
one_of_schemas: List[str] = Field(COMPONENT_ONE_OF_SCHEMAS, const=True)
Expand Down Expand Up @@ -79,16 +82,23 @@ def actual_instance_must_validate_oneof(cls, v):
)
else:
match += 1
# validate data type: ComponentFile
if not isinstance(v, ComponentFile):
error_messages.append(
f"Error! Input type `{type(v)}` is not `ComponentFile`"
)
else:
match += 1
if match > 1:
# more than 1 match
raise ValueError(
"Multiple matches found when setting `actual_instance` in Component with oneOf schemas: ComponentHLS, ComponentRTSP. Details: "
"Multiple matches found when setting `actual_instance` in Component with oneOf schemas: ComponentFile, ComponentHLS, ComponentRTSP. Details: "
+ ", ".join(error_messages)
)
elif match == 0:
# no match
raise ValueError(
"No match found when setting `actual_instance` in Component with oneOf schemas: ComponentHLS, ComponentRTSP. Details: "
"No match found when setting `actual_instance` in Component with oneOf schemas: ComponentFile, ComponentHLS, ComponentRTSP. Details: "
+ ", ".join(error_messages)
)
else:
Expand All @@ -112,6 +122,11 @@ def from_json(cls, json_str: str) -> Component:
"Failed to lookup data type from the field `type` in the input."
)

# check if data type is `ComponentFile`
if _data_type == "ComponentFile":
instance.actual_instance = ComponentFile.from_json(json_str)
return instance

# check if data type is `ComponentHLS`
if _data_type == "ComponentHLS":
instance.actual_instance = ComponentHLS.from_json(json_str)
Expand All @@ -122,6 +137,11 @@ def from_json(cls, json_str: str) -> Component:
instance.actual_instance = ComponentRTSP.from_json(json_str)
return instance

# check if data type is `ComponentFile`
if _data_type == "file":
instance.actual_instance = ComponentFile.from_json(json_str)
return instance

# check if data type is `ComponentHLS`
if _data_type == "hls":
instance.actual_instance = ComponentHLS.from_json(json_str)
Expand All @@ -144,17 +164,23 @@ def from_json(cls, json_str: str) -> Component:
match += 1
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
# deserialize data into ComponentFile
try:
instance.actual_instance = ComponentFile.from_json(json_str)
match += 1
except (ValidationError, ValueError) as e:
error_messages.append(str(e))

if match > 1:
# more than 1 match
raise ValueError(
"Multiple matches found when deserializing the JSON string into Component with oneOf schemas: ComponentHLS, ComponentRTSP. Details: "
"Multiple matches found when deserializing the JSON string into Component with oneOf schemas: ComponentFile, ComponentHLS, ComponentRTSP. Details: "
+ ", ".join(error_messages)
)
elif match == 0:
# no match
raise ValueError(
"No match found when deserializing the JSON string into Component with oneOf schemas: ComponentHLS, ComponentRTSP. Details: "
"No match found when deserializing the JSON string into Component with oneOf schemas: ComponentFile, ComponentHLS, ComponentRTSP. Details: "
+ ", ".join(error_messages)
)
else:
Expand Down
65 changes: 65 additions & 0 deletions jellyfish/_openapi_client/models/component_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# coding: utf-8

"""
Python API wrapper for Jellyfish Media Server

The version of the OpenAPI document: 0.2.0
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
""" # noqa: E501


from __future__ import annotations
import pprint
import re # noqa: F401
import json


from pydantic import BaseModel, Field, StrictStr


class ComponentFile(BaseModel):
"""
Describes the File component
"""

id: StrictStr = Field(..., description="Assigned component ID")
type: StrictStr = Field(..., description="Component type")
__properties = ["id", "type"]

class Config:
"""Pydantic configuration"""

allow_population_by_field_name = True
validate_assignment = True

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
return json.dumps(self.to_dict())

@classmethod
def from_json(cls, json_str: str) -> ComponentFile:
"""Create an instance of ComponentFile from a JSON string"""
return cls.from_dict(json.loads(json_str))

def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
return _dict

@classmethod
def from_dict(cls, obj: dict) -> ComponentFile:
"""Create an instance of ComponentFile from a dict"""
if obj is None:
return None

if not isinstance(obj, dict):
return ComponentFile.parse_obj(obj)

_obj = ComponentFile.parse_obj({"id": obj.get("id"), "type": obj.get("type")})
return _obj
20 changes: 11 additions & 9 deletions jellyfish/_openapi_client/models/component_hls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@


from pydantic import BaseModel, Field, StrictStr
from jellyfish._openapi_client.models.component_metadata_hls import ComponentMetadataHLS
from jellyfish._openapi_client.models.component_properties_hls import (
ComponentPropertiesHLS,
)


class ComponentHLS(BaseModel):
"""
Describes HLS component
Describes the HLS component
"""

id: StrictStr = Field(..., description="Assigned component ID")
metadata: ComponentMetadataHLS = Field(...)
properties: ComponentPropertiesHLS = Field(...)
type: StrictStr = Field(..., description="Component type")
__properties = ["id", "metadata", "type"]
__properties = ["id", "properties", "type"]

class Config:
"""Pydantic configuration"""
Expand All @@ -52,9 +54,9 @@ def from_json(cls, json_str: str) -> ComponentHLS:
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
# override the default output from pydantic by calling `to_dict()` of metadata
if self.metadata:
_dict["metadata"] = self.metadata.to_dict()
# override the default output from pydantic by calling `to_dict()` of properties
if self.properties:
_dict["properties"] = self.properties.to_dict()
return _dict

@classmethod
Expand All @@ -69,8 +71,8 @@ def from_dict(cls, obj: dict) -> ComponentHLS:
_obj = ComponentHLS.parse_obj(
{
"id": obj.get("id"),
"metadata": ComponentMetadataHLS.from_dict(obj.get("metadata"))
if obj.get("metadata") is not None
"properties": ComponentPropertiesHLS.from_dict(obj.get("properties"))
if obj.get("properties") is not None
else None,
"type": obj.get("type"),
}
Expand Down
Loading