book-system-SDK


Namebook-system-SDK JSON
Version 0.1.8 PyPI version JSON
download
home_page
SummarySDK for interaction with the book-system API
upload_time2023-10-28 07:42:17
maintainer
docs_urlNone
authorArtem Sydorenko
requires_python>=3.11
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # book-system-SDK
## Introduction
The Book-System SDK is a powerful tool designed to simplify the integration of the Book-System API into your application. This SDK streamlines the process of accessing and utilizing the API's features, making it easy for developers to incorporate event management, room configuration, and seat booking functionality into their software solutions.

## Key Features
- Easy Integration: The SDK provides a straightforward and developer-friendly interface for interacting with the Book-System API. You can quickly integrate booking capabilities into your application without the need for complex API calls.

- Event Management: Effortlessly create, retrieve, and manage events in your venue. The SDK abstracts away the intricacies of event handling, allowing you to focus on providing a seamless booking experience to your users.

- Room Configuration: Easily configure and manage rooms to suit various event types. Whether you're dealing with theaters, cinemas, or any other venue, this SDK has you covered in adapting room setups to your needs.

- Seat Booking: Simplify the seat booking process by using the SDK's intuitive methods. Your users can enjoy a hassle-free experience when reserving seats for their chosen events.

## Installation

You can install SDK using pip:

```
pip install book-system-sdk
```

## Examples

### Example 1: Creating a Room and Fetching Room Details
```python

from your_module import BookSystemSDK, Room

# Initialize the BookSystemSDK with the API URL
sdk = BookSystemSDK(api_url="https://example.com/api")

# Create a new room
new_room = Room(name="Conference Room A", columns=5, rows=10)
created_room = sdk.create(new_room)
print("Created Room:", created_room.name)

# Fetch room details by ID
room_id_to_fetch = created_room.id
fetched_room = sdk.get(model=Room, by_id=room_id_to_fetch)
print("Fetched Room:", fetched_room.name)
```
### Example 2: Creating an Event and Fetching Event Details
```python

from your_module import BookSystemSDK, Event

# Initialize the BookSystemSDK with the API URL
sdk = BookSystemSDK(api_url="https://example.com/api")

# Create a new event
new_event = Event(title="Product Launch")
created_event = sdk.create(new_event)
print("Created Event:", created_event.title)

# Fetch event details by ID
event_id_to_fetch = created_event.id
fetched_event = sdk.get(model=Event, by_id=event_id_to_fetch)
print("Fetched Event:", fetched_event.title)
```
### Example 3: Booking a Seat for an Event
```python

from your_module import BookSystemSDK, Booking, Event, Room

# Initialize the BookSystemSDK with the API URL
sdk = BookSystemSDK(api_url="https://example.com/api")

# Fetch an event and room to book
event_to_book = sdk.get(model=Event, by_id=1)
room_to_book = sdk.get(model=Room, by_id=2)

# Define booking details
booking_start = datetime.datetime(2023, 9, 30, 10, 0)
booking_end = datetime.datetime(2023, 9, 30, 12, 0)

# Create a booking
new_booking = Booking(
    time_start=booking_start,
    time_finish=booking_end,
    event=event_to_book,
    room=room_to_book
)
created_booking = sdk.create(new_booking)
print("Created Booking ID:", created_booking.id)
```

The `BookSystemSDK` class provides an interface for interacting with a booking system API. It allows you to manage rooms, events, and bookings within the system.

## Constructor
### `__init__(self,api_url: str, rooms: List[Room] | None = None, events: List[Event] | None = None, booking: List[Booking] | None = None)`

- `api_url` (str): The base URL of the API.
- `rooms` (List[Room] | None): Optional initial list of Room objects.
- `events` (List[Event] | None): Optional initial list of Event objects.
- `booking` (List[Booking] | None): Optional initial list of Booking objects.

## Properties
### `rooms`

- Returns a list of Room objects fetched from the API.

### `events`

- Returns a list of Event objects fetched from the API.

### `booking`

- Returns a list of Booking objects fetched from the API.

## Methods

### `create(self, obj: TypeModel) -> TypeModel`

- Creates a new object of the specified type in the API.

### `refresh(self, obj: TypeModel) -> TypeModel`

- Refreshes the data of an existing object in the API.

### `delete(self, obj: TypeModel | List[TypeModel]) -> None`

- Deletes an object or a list of objects from the API.

### `get(self, model: TypeModel, by: TypeModel | None = None, by_id: int | None = None,  **kwargs) -> TypeModel`

- Retrieves an object from the API based on specified filters and parameters.

### `_make_request(self, url: str, method: Literal["GET", "POST", "PATCH", "DELETE"], body: dict | None = None, params: dict | None = None) -> dict`

- Makes an HTTP request to the API and handles responses.

# Seat Documentation

The `Seat` class represents a seat in a room and provides methods to interact with seat data.

## Constructor
### `__init__(self, row: int, column: int, number: int, booked: bool = False, id: int | None = None, additional_data: dict | None = None)`

- `row` (int): The row number of the seat.
- `column` (int): The column number of the seat.
- `number` (int): The seat number.
- `booked` (bool): Whether the seat is booked (default is False).
- `id` (int | None): The ID of the seat (optional).
- `additional_data` (dict | None): Additional data related to the seat (optional).

## Class Methods
### `from_json(cls, seat: dict)`

- Creates a Seat object from a JSON dictionary obtained from the API.

## Properties
### `room`

- TODO: A property that is intended to fetch the room associated with the seat in the database. (To be implemented)

### `body`

- Returns the data of the Seat object in a dictionary format for API requests.

### `params`

- Returns query parameters for API requests (currently empty).

# Room Documentation

The `Room` class represents a room in the booking system and provides methods to interact with room data.

## Constructor
### `__init__(self, id: int | None = None, name: str | None = None, seats: list[Seat] | None = None, autogenerate_seats: bool = False, columns: int | None = None, rows: int | None = None)`

- `id` (int | None): The ID of the room (optional).
- `name` (str | None): The name of the room (optional).
- `seats` (list[Seat] | None): A list of Seat objects associated with the room (optional).
- `autogenerate_seats` (bool): Whether to automatically generate seats (default is False).
- `columns` (int | None): The number of columns for seat generation (optional).
- `rows` (int | None): The number of rows for seat generation (optional).

## Class Methods
### `from_json(cls, room: dict)`

- Creates a Room object from a JSON dictionary obtained from the API.

## Properties
### `body`

- Returns the data of the Room object in a dictionary format for API requests.

### `params`

- Returns query parameters for API requests.

# Event Documentation

The `Event` class represents an event in the booking system and provides methods to interact with event data.

## Constructor
### `__init__(self, title: str, id: int | None = None, additional_data: dict | None = None)`

- `title` (str): The title of the event.
- `id` (int | None): The ID of the event (optional).
- `additional_data` (dict | None): Additional data related to the event (optional).

## Class Methods
### `from_json(cls, event: dict)`

- Creates an Event object from a JSON dictionary obtained from the API.

## Properties
### `body`

- Returns the data of the Event object in a dictionary format for API requests.

### `params`

- Returns query parameters for API requests (currently empty).

# Booking Documentation

The `Booking` class represents a booking in the booking system and provides methods to interact with booking data.

## Constructor
### `__init__(self, time_start: datetime.datetime, time_finish: datetime.datetime, event_id: int | None = None, room_id: int | None = None, event: Event | None = None, room: Room | None = None, id: int | None = None, additional_data: dict | None = None)`

- `time_start` (datetime.datetime): The start time of the booking.
- `time_finish` (datetime.datetime): The end time of the booking.
- `event_id` (int | None): The ID of the associated event (optional).
- `room_id` (int | None): The ID of the associated room (optional).
- `event` (Event | None): An Event object associated with the booking (optional).
- `room` (Room | None): A Room object associated with the booking (optional).
- `id` (int | None): The ID of the booking (optional).
- `additional_data` (dict | None): Additional data related to the booking (optional).

## Class Methods
### `from_json(cls, booking: dict)`

- Creates a Booking object from a JSON dictionary obtained from the API.

## Properties
### `body`

- Returns the data of the Booking object in a dictionary format for API requests.

### `params`

- Returns query parameters for API requests (currently empty).

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "book-system-SDK",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "",
    "keywords": "",
    "author": "Artem Sydorenko",
    "author_email": "kradworkmail@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b7/1c/825cdb31b80fe36ff42abfc1f0d4cc8d31ab4e769c33349e85de2841cd2f/book-system-SDK-0.1.8.tar.gz",
    "platform": null,
    "description": "# book-system-SDK\n## Introduction\nThe Book-System SDK is a powerful tool designed to simplify the integration of the Book-System API into your application. This SDK streamlines the process of accessing and utilizing the API's features, making it easy for developers to incorporate event management, room configuration, and seat booking functionality into their software solutions.\n\n## Key Features\n- Easy Integration: The SDK provides a straightforward and developer-friendly interface for interacting with the Book-System API. You can quickly integrate booking capabilities into your application without the need for complex API calls.\n\n- Event Management: Effortlessly create, retrieve, and manage events in your venue. The SDK abstracts away the intricacies of event handling, allowing you to focus on providing a seamless booking experience to your users.\n\n- Room Configuration: Easily configure and manage rooms to suit various event types. Whether you're dealing with theaters, cinemas, or any other venue, this SDK has you covered in adapting room setups to your needs.\n\n- Seat Booking: Simplify the seat booking process by using the SDK's intuitive methods. Your users can enjoy a hassle-free experience when reserving seats for their chosen events.\n\n## Installation\n\nYou can install SDK using pip:\n\n```\npip install book-system-sdk\n```\n\n## Examples\n\n### Example 1: Creating a Room and Fetching Room Details\n```python\n\nfrom your_module import BookSystemSDK, Room\n\n# Initialize the BookSystemSDK with the API URL\nsdk = BookSystemSDK(api_url=\"https://example.com/api\")\n\n# Create a new room\nnew_room = Room(name=\"Conference Room A\", columns=5, rows=10)\ncreated_room = sdk.create(new_room)\nprint(\"Created Room:\", created_room.name)\n\n# Fetch room details by ID\nroom_id_to_fetch = created_room.id\nfetched_room = sdk.get(model=Room, by_id=room_id_to_fetch)\nprint(\"Fetched Room:\", fetched_room.name)\n```\n### Example 2: Creating an Event and Fetching Event Details\n```python\n\nfrom your_module import BookSystemSDK, Event\n\n# Initialize the BookSystemSDK with the API URL\nsdk = BookSystemSDK(api_url=\"https://example.com/api\")\n\n# Create a new event\nnew_event = Event(title=\"Product Launch\")\ncreated_event = sdk.create(new_event)\nprint(\"Created Event:\", created_event.title)\n\n# Fetch event details by ID\nevent_id_to_fetch = created_event.id\nfetched_event = sdk.get(model=Event, by_id=event_id_to_fetch)\nprint(\"Fetched Event:\", fetched_event.title)\n```\n### Example 3: Booking a Seat for an Event\n```python\n\nfrom your_module import BookSystemSDK, Booking, Event, Room\n\n# Initialize the BookSystemSDK with the API URL\nsdk = BookSystemSDK(api_url=\"https://example.com/api\")\n\n# Fetch an event and room to book\nevent_to_book = sdk.get(model=Event, by_id=1)\nroom_to_book = sdk.get(model=Room, by_id=2)\n\n# Define booking details\nbooking_start = datetime.datetime(2023, 9, 30, 10, 0)\nbooking_end = datetime.datetime(2023, 9, 30, 12, 0)\n\n# Create a booking\nnew_booking = Booking(\n    time_start=booking_start,\n    time_finish=booking_end,\n    event=event_to_book,\n    room=room_to_book\n)\ncreated_booking = sdk.create(new_booking)\nprint(\"Created Booking ID:\", created_booking.id)\n```\n\nThe `BookSystemSDK` class provides an interface for interacting with a booking system API. It allows you to manage rooms, events, and bookings within the system.\n\n## Constructor\n### `__init__(self,api_url: str, rooms: List[Room] | None = None, events: List[Event] | None = None, booking: List[Booking] | None = None)`\n\n- `api_url` (str): The base URL of the API.\n- `rooms` (List[Room] | None): Optional initial list of Room objects.\n- `events` (List[Event] | None): Optional initial list of Event objects.\n- `booking` (List[Booking] | None): Optional initial list of Booking objects.\n\n## Properties\n### `rooms`\n\n- Returns a list of Room objects fetched from the API.\n\n### `events`\n\n- Returns a list of Event objects fetched from the API.\n\n### `booking`\n\n- Returns a list of Booking objects fetched from the API.\n\n## Methods\n\n### `create(self, obj: TypeModel) -> TypeModel`\n\n- Creates a new object of the specified type in the API.\n\n### `refresh(self, obj: TypeModel) -> TypeModel`\n\n- Refreshes the data of an existing object in the API.\n\n### `delete(self, obj: TypeModel | List[TypeModel]) -> None`\n\n- Deletes an object or a list of objects from the API.\n\n### `get(self, model: TypeModel, by: TypeModel | None = None, by_id: int | None = None,  **kwargs) -> TypeModel`\n\n- Retrieves an object from the API based on specified filters and parameters.\n\n### `_make_request(self, url: str, method: Literal[\"GET\", \"POST\", \"PATCH\", \"DELETE\"], body: dict | None = None, params: dict | None = None) -> dict`\n\n- Makes an HTTP request to the API and handles responses.\n\n# Seat Documentation\n\nThe `Seat` class represents a seat in a room and provides methods to interact with seat data.\n\n## Constructor\n### `__init__(self, row: int, column: int, number: int, booked: bool = False, id: int | None = None, additional_data: dict | None = None)`\n\n- `row` (int): The row number of the seat.\n- `column` (int): The column number of the seat.\n- `number` (int): The seat number.\n- `booked` (bool): Whether the seat is booked (default is False).\n- `id` (int | None): The ID of the seat (optional).\n- `additional_data` (dict | None): Additional data related to the seat (optional).\n\n## Class Methods\n### `from_json(cls, seat: dict)`\n\n- Creates a Seat object from a JSON dictionary obtained from the API.\n\n## Properties\n### `room`\n\n- TODO: A property that is intended to fetch the room associated with the seat in the database. (To be implemented)\n\n### `body`\n\n- Returns the data of the Seat object in a dictionary format for API requests.\n\n### `params`\n\n- Returns query parameters for API requests (currently empty).\n\n# Room Documentation\n\nThe `Room` class represents a room in the booking system and provides methods to interact with room data.\n\n## Constructor\n### `__init__(self, id: int | None = None, name: str | None = None, seats: list[Seat] | None = None, autogenerate_seats: bool = False, columns: int | None = None, rows: int | None = None)`\n\n- `id` (int | None): The ID of the room (optional).\n- `name` (str | None): The name of the room (optional).\n- `seats` (list[Seat] | None): A list of Seat objects associated with the room (optional).\n- `autogenerate_seats` (bool): Whether to automatically generate seats (default is False).\n- `columns` (int | None): The number of columns for seat generation (optional).\n- `rows` (int | None): The number of rows for seat generation (optional).\n\n## Class Methods\n### `from_json(cls, room: dict)`\n\n- Creates a Room object from a JSON dictionary obtained from the API.\n\n## Properties\n### `body`\n\n- Returns the data of the Room object in a dictionary format for API requests.\n\n### `params`\n\n- Returns query parameters for API requests.\n\n# Event Documentation\n\nThe `Event` class represents an event in the booking system and provides methods to interact with event data.\n\n## Constructor\n### `__init__(self, title: str, id: int | None = None, additional_data: dict | None = None)`\n\n- `title` (str): The title of the event.\n- `id` (int | None): The ID of the event (optional).\n- `additional_data` (dict | None): Additional data related to the event (optional).\n\n## Class Methods\n### `from_json(cls, event: dict)`\n\n- Creates an Event object from a JSON dictionary obtained from the API.\n\n## Properties\n### `body`\n\n- Returns the data of the Event object in a dictionary format for API requests.\n\n### `params`\n\n- Returns query parameters for API requests (currently empty).\n\n# Booking Documentation\n\nThe `Booking` class represents a booking in the booking system and provides methods to interact with booking data.\n\n## Constructor\n### `__init__(self, time_start: datetime.datetime, time_finish: datetime.datetime, event_id: int | None = None, room_id: int | None = None, event: Event | None = None, room: Room | None = None, id: int | None = None, additional_data: dict | None = None)`\n\n- `time_start` (datetime.datetime): The start time of the booking.\n- `time_finish` (datetime.datetime): The end time of the booking.\n- `event_id` (int | None): The ID of the associated event (optional).\n- `room_id` (int | None): The ID of the associated room (optional).\n- `event` (Event | None): An Event object associated with the booking (optional).\n- `room` (Room | None): A Room object associated with the booking (optional).\n- `id` (int | None): The ID of the booking (optional).\n- `additional_data` (dict | None): Additional data related to the booking (optional).\n\n## Class Methods\n### `from_json(cls, booking: dict)`\n\n- Creates a Booking object from a JSON dictionary obtained from the API.\n\n## Properties\n### `body`\n\n- Returns the data of the Booking object in a dictionary format for API requests.\n\n### `params`\n\n- Returns query parameters for API requests (currently empty).\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "SDK for interaction with the book-system API",
    "version": "0.1.8",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b71c825cdb31b80fe36ff42abfc1f0d4cc8d31ab4e769c33349e85de2841cd2f",
                "md5": "3deb95f4eea9cab75535f98db3722180",
                "sha256": "9ca6a81cba43fc30eb3b39643eee81e9e64c57836f7d4e604e120caf564f50f6"
            },
            "downloads": -1,
            "filename": "book-system-SDK-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "3deb95f4eea9cab75535f98db3722180",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 9519,
            "upload_time": "2023-10-28T07:42:17",
            "upload_time_iso_8601": "2023-10-28T07:42:17.508851Z",
            "url": "https://files.pythonhosted.org/packages/b7/1c/825cdb31b80fe36ff42abfc1f0d4cc8d31ab4e769c33349e85de2841cd2f/book-system-SDK-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-28 07:42:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "book-system-sdk"
}
        
Elapsed time: 0.52705s