
# Darsman MEDIA-SDK

MEDIA-SDK for integrate with Darsman MEDIA service


## Installation

Install dmmc with pip

```bash
pip install dmmc
```


## Usage/Examples

```python
from darsman_media.interface import MediaSDK


darsman_media = MediaSDK(url='localhost:50051')
```

if you want to ..
### retrieve media:


```python
darsman_media.media(api_key='TEST_API_KEY', uuid_id='...')
```
response  ==> dict

### create media:


```python
darsman_media.create_media(
                            api_key='TEST_API_KEY',
                            file: str,
                            file_name,
                            extension,
                            file_size,
                            bucket,
                            store_place_type,
                            acl='public-read',
                            create_identifier=None,
                            **kwargs
                            )
```
* the file parameter is the file dircetion you want to upload

* file_name and extension are for save in destination

* **kwargs are the other field of media those are optional

response  ==> dict

### validate media:

to undrestand a media exist or not

```python
darsman_media.validate_media(api_key='TEST_API_KEY', uuid_id='...')
```
response  ==> True or False




### retrieve bucket:


```python
darsman_media.bucket(api_key='TEST_API_KEY', uuid_id='...', **kwargs)
```
response  ==> dict


### create bucket:
could determine is_public in kwargs

```python
darsman_media.create_bucket(api_key='TEST_API_KEY', name='test', **kwargs)
```
response  ==> dict


### update bucket:
could determine is_public and name in kwargs

```python
darsman_media.update_bucket(api_key='TEST_API_KEY', **kwargs)
```
response  ==> dict

### validate bucket:
could determine is_public and name in kwargs

```python
darsman_media.validate_bucket(api_key='TEST_API_KEY', uuid_id='..')
```
response  ==> True or False
