Skip to content
Merged
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
3 changes: 0 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ jobs:
- run:
name: Lint
command: poetry run lint
- run:
name: Check code formatting
command: poetry run check_format
- persist_to_workspace:
root: ~/project
paths:
Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,31 @@ Create a `RoomApi` instance, providing the jellyfish server address and api toke
```python
from jellyfish import RoomApi

room_api = RoomApi(server_address='localhost:5002', server_api_token='development')
room_api = RoomApi(server_address="localhost:5002", server_api_token="development")
```

You can use it to interact with Jellyfish, manage rooms, peers and components

```python
# Create a room
jellyfish_address, room = room_api.create_room(video_codec='h264')
# 'localhost:5002', Room(components=[], config=RoomConfig(max_peers=None, video_codec='h264'), id='5a099a31-0eb2-4c28-84af-a1ec55c228af', peers=[]))
jellyfish_address, room = room_api.create_room(video_codec="h264", webhook_url="http://localhost:5000/webhook")
# '127.0.0.1:5002', Room(components=[], config=RoomConfig(max_peers=None, video_codec=<RoomConfigVideoCodec.H264: 'h264'>, webhook_url='http://localhost:5000/webhook'), id='1d905478-ccfc-44d6-a6e7-8ccb1b38d955', peers=[])

# Add peer to the room
from jellyfish import PeerOptionsWebRTC

peer_token, peer_webrtc = room_api.add_peer(room.id, options=PeerOptionsWebRTC())
# 'AgDYfrCSigFiAA', Peer(id='2869fb5', status=<PeerStatus.DISCONNECTED: 'disconnected'>, type='webrtc')
# 'M8TUGhj-L11KpyG-2zBPIo', Peer(id='b1232c7e-c969-4450-acdf-ea24f3cdd7f6', status=<PeerStatus.DISCONNECTED: 'disconnected'>, type='webrtc')

# Add component to the room
from jellyfish import ComponentOptionsHLS

component_hls = room_api.add_component(room.id, options=ComponentOptionsHLS())
# Component(actual_instance=ComponentHLS(id='c0dfab50-cafd-438d-985e-7b8f97ae55e3', metadata=ComponentMetadataHLS(low_latency=False, playable=False), type='hls'))
# ComponentHLS(id='5f062447-a9f7-45ed-8d1b-511f77dc78ae', properties=ComponentPropertiesHLS(low_latency=False, persistent=False, playable=False, subscribe_mode=<ComponentPropertiesHLSSubscribeMode.AUTO: 'auto'>, target_window_duration=None), type='hls')
```

All methods in `RoomApi` may raise one of the exceptions deriving from `jellyfish.errors.HTTPError`. They are defined in `jellyfish.errors`.

#### Notifier

Create `Notifier` instance
Expand Down Expand Up @@ -96,14 +98,14 @@ You can test the SDK by running
poetry run ci_test
```

## Format&Lint
## Format & Lint
You can format code by running
```console
poetry run format
```

You can check linter by running
```
```console
poetry run lint
```

Expand Down
16 changes: 0 additions & 16 deletions generate_client.sh

This file was deleted.

63 changes: 29 additions & 34 deletions jellyfish/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,53 @@

# pylint: disable=locally-disabled, no-name-in-module, import-error

from pydantic.error_wrappers import ValidationError

# API
from jellyfish._room_api import RoomApi
from jellyfish._recording_api import RecordingApi
from jellyfish._ws_notifier import Notifier
from jellyfish._webhook_notifier import receive_json
# Exceptions and Server Messages
from jellyfish import errors, events

# Models
from jellyfish._openapi_client import (
Room,
RoomConfig,
Peer,
Component,
from jellyfish._openapi_client.models import (
ComponentHLS,
ComponentRTSP,
ComponentOptions,
ComponentOptionsRTSP,
ComponentOptionsHLS,
ComponentOptionsHLSSubscribeMode,
ComponentOptionsRTSP,
ComponentPropertiesHLS,
ComponentPropertiesHLSSubscribeMode,
ComponentPropertiesRTSP,
ComponentRTSP,
Peer,
PeerOptionsWebRTC,
PeerStatus,
Room,
RoomConfig,
RoomConfigVideoCodec,
)

# Server Messages
from jellyfish import events

# Exceptions
from jellyfish._openapi_client.exceptions import (
UnauthorizedException,
NotFoundException,
BadRequestException,
)

# API
from jellyfish._webhook_notifier import receive_json
from jellyfish._ws_notifier import Notifier
from jellyfish.api._recording_api import RecordingApi
from jellyfish.api._room_api import RoomApi

__all__ = [
"RoomApi",
"RecordingApi",
"Notifier",
"receive_json",
"Room",
"RoomConfig",
"RoomConfigVideoCodec",
"Peer",
"Component",
"PeerOptionsWebRTC",
"PeerStatus",
"ComponentHLS",
"ComponentRTSP",
"ComponentOptionsHLS",
"RoomConfig",
"ComponentOptions",
"ComponentOptionsHLSSubscribeMode",
"ComponentPropertiesHLS",
"ComponentPropertiesHLSSubscribeMode",
"ComponentRTSP",
"ComponentOptionsRTSP",
"PeerOptionsWebRTC",
"ComponentPropertiesRTSP",
"events",
"UnauthorizedException",
"NotFoundException",
"BadRequestException",
"errors",
]

__docformat__ = "restructuredtext"
76 changes: 5 additions & 71 deletions jellyfish/_openapi_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,73 +1,7 @@
# coding: utf-8
""" A client library for accessing Jellyfish Media Server """
from .client import AuthenticatedClient, Client

# flake8: noqa

"""
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


__version__ = "1.0.0"

# import apis into sdk package
from jellyfish._openapi_client.api.hls_api import HlsApi
from jellyfish._openapi_client.api.recording_api import RecordingApi
from jellyfish._openapi_client.api.room_api import RoomApi

# import ApiClient
from jellyfish._openapi_client.api_response import ApiResponse
from jellyfish._openapi_client.api_client import ApiClient
from jellyfish._openapi_client.configuration import Configuration
from jellyfish._openapi_client.exceptions import OpenApiException
from jellyfish._openapi_client.exceptions import ApiTypeError
from jellyfish._openapi_client.exceptions import ApiValueError
from jellyfish._openapi_client.exceptions import ApiKeyError
from jellyfish._openapi_client.exceptions import ApiAttributeError
from jellyfish._openapi_client.exceptions import ApiException

# import models into sdk package
from jellyfish._openapi_client.models.add_component_request import AddComponentRequest
from jellyfish._openapi_client.models.add_peer_request import AddPeerRequest
from jellyfish._openapi_client.models.component import Component
from jellyfish._openapi_client.models.component_details_response import (
ComponentDetailsResponse,
)
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_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_rtsp import ComponentRTSP
from jellyfish._openapi_client.models.error import Error
from jellyfish._openapi_client.models.hls_skip import HlsSkip
from jellyfish._openapi_client.models.peer import Peer
from jellyfish._openapi_client.models.peer_details_response import PeerDetailsResponse
from jellyfish._openapi_client.models.peer_details_response_data import (
PeerDetailsResponseData,
)
from jellyfish._openapi_client.models.peer_options import PeerOptions
from jellyfish._openapi_client.models.peer_options_web_rtc import PeerOptionsWebRTC
from jellyfish._openapi_client.models.peer_status import PeerStatus
from jellyfish._openapi_client.models.recording_list_response import (
RecordingListResponse,
)
from jellyfish._openapi_client.models.room import Room
from jellyfish._openapi_client.models.room_config import RoomConfig
from jellyfish._openapi_client.models.room_create_details_response import (
RoomCreateDetailsResponse,
)
from jellyfish._openapi_client.models.room_create_details_response_data import (
RoomCreateDetailsResponseData,
__all__ = (
"AuthenticatedClient",
"Client",
)
from jellyfish._openapi_client.models.room_details_response import RoomDetailsResponse
from jellyfish._openapi_client.models.rooms_listing_response import RoomsListingResponse
from jellyfish._openapi_client.models.s3_credentials import S3Credentials
from jellyfish._openapi_client.models.subscription_config import SubscriptionConfig
7 changes: 1 addition & 6 deletions jellyfish/_openapi_client/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
# flake8: noqa

# import apis into api package
from jellyfish._openapi_client.api.hls_api import HlsApi
from jellyfish._openapi_client.api.recording_api import RecordingApi
from jellyfish._openapi_client.api.room_api import RoomApi
""" Contains methods for accessing the API """
Empty file.
Loading