12/08
2015
More info: http://dev.sambatech.com/
, (*2)
Composer, (*3)
Update your composer.json
file to include this package as a dependency, (*4)
"replay4me/samba":"dev-master"
**Service Providers***, (*5)
Register the Samba service provider by adding it to the providers array in the app/config/app.php
, (*6)
'Eduardostuart\Samba\SambaServiceProvider',
Aliases, (*7)
Alias the Samba facade by adding it to the aliases array in the app/config/app.php
, (*8)
'Samba' => 'Eduardostuart\Samba\Facades\SambaFacade',
Config Publish, (*9)
php artisan config:publish replay4me/samba
Upload file, (*10)
Optional Parameter:, (*11)
mediaType: VIDEO or AUDIO (default: VIDEO)
, (*12)
try { print_r( Samba::upload()->send( array( 'projectId' => $projectId, 'file' => $myFile // Input::get('file') ) )->body() ); }catch( CouldNotUploadException $e ) { echo 'Could not upload file :('; }catch( InvalidFileUploadException $e ) { echo 'Ops! Invalid file'; }
Create new project, (*13)
try { print_r( Samba::projects()->create( array( 'name' => 'Project name', 'description' => 'My awesome project' ) )->body() ); }catch(CouldNotCreateProjectException $e) { echo 'Ops! Could not create project'; }
Show projects, (*14)
try { print_r( Samba::projects()->show()->body() ); }catch(WrongResponseException $e ) { echo 'There was an error...'; }
Get a specific project, (*15)
try { $projectId = 1234; print_r( Samba::projects()->show( $projectId )->body() ); }catch(WrongResponseException $e ) { echo 'There was an error...'; }
Show a project medias, (*16)
try { $projectId = 1234; print_r( Samba::medias()->show($projectId)->body() ); }catch(MediaNotFoundException $e ) { echo 'Media not found'; }
*Show a specific media, (*17)
try { $projectId = 1234; $mediaId = 'abcdefghij'; print_r( Samba::medias()->show( $projectId , $mediaId )->body() ); }catch(MediaNotFoundException $e ) { echo 'Media not found'; }
Remove a specific media, (*18)
try { $projectId = 1234; $mediaId = 'abcdefghij'; var_dump( Samba::medias()->remove( $projectId , $mediaId )->body() ); }catch(MediaNotFoundException $e ) { echo 'Media not found'; }
Show all categories, (*19)
try { $projectId = 1234; var_dump( Samba::categories()->show( $projectId )->body() ); }catch(WrongResponseException $e ) { echo 'There was an error...'; }
Get a category, (*20)
try { $categoryId = 5555; $projectId = 1234; var_dump( Samba::categories()->show( $projectId , $categoryId )->body() ); }catch(WrongResponseException $e ) { echo 'There was an error...'; }
Create a category, (*21)
try { $parentId = 1234; // or null.. var_dump( Samba::categories()->create( $projectId , 'My super Category' , $parentId )->body() ); }catch(CouldNotCreateCategoryException $e ) { echo 'Ops! There was an error...'; }