Skip to content

Commit 814c7bc

Browse files
authored
Merge pull request #140 from renderforest/update-api
Update SDK
2 parents 079c230 + 7a1a992 commit 814c7bc

File tree

12 files changed

+476
-110
lines changed

12 files changed

+476
-110
lines changed

composer.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
{
22
"name": "renderforest/sdk-php",
33
"description": "Renderforest SDK for PHP",
4-
"version": "0.4.6",
4+
"version": "0.5.0",
55
"homepage": "https://github.com/renderforest/renderforest-sdk-php",
6-
"authors": [
7-
{
8-
"name": "Narek Hovhannisyan",
9-
"email": "[email protected]"
10-
}
11-
],
126
"keywords": [
137
"animation maker",
148
"api",

doc/SOUNDS_API.md

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,48 @@
22

33
**For detailed usage please see examples for each method.**
44

5-
- [Get All Sounds](#get-all-sounds)
6-
- [Get Recommended Sounds](#get-recommended-sounds)
5+
- [Get All Sounds](#get-all-sounds)
6+
- [Get Company's Library Sounds](#get-companys-library-sounds)
7+
- [Get Recommended Sounds](#get-recommended-sounds)
78

89
### Get All Sounds
910

10-
Retrieves sounds given the duration (authorization is not required).
11-
If the authorization is not present, then response limits to 5.
11+
Retrieves sounds given the duration (authorization is required).
12+
13+
```php
14+
<?php
15+
16+
require '../../vendor/autoload.php';
17+
18+
$renderforestClient = new \Renderforest\ApiClient(
19+
'your-api-key',
20+
'your-client-id'
21+
);
22+
23+
$sounds = $renderforestClient->getAllSounds(15);
24+
```
1225

26+
- The sounds will have greater or equal duration to the specified one.
27+
- **Remember** — any given value of the duration greater than 180 will be overridden by 180!
28+
29+
[See get all sounds example](/examples/sounds/get-all-sounds.php)
30+
31+
### Get Company's Library Sounds
32+
33+
Retrieves company's library sounds for given duration (authorization is not required).
34+
If the authorization is not present, then response limits to 5.
35+
1336
```php
1437
<?php
1538

1639
require '../../vendor/autoload.php';
1740

18-
$sounds = \Renderforest\ApiClient::getAllSoundsLimited(15);
41+
$sounds = \Renderforest\ApiClient::getCompanySoundsLimited(15);
1942
```
20-
[See get all sounds limited example](/examples/sounds/get-all-sounds-limited.php)
2143

22-
With authorization it's possible to fetch all sounds.
44+
[See get company's library sounds limited example](/examples/sounds/get-company-sounds-limited.php)
45+
46+
With authorization it's possible to fetch all library sounds.
2347

2448
```php
2549
<?php
@@ -31,13 +55,12 @@ $renderforestClient = new \Renderforest\ApiClient(
3155
'your-client-id'
3256
);
3357

34-
$sounds = $renderforestClient->getAllSounds(15);
58+
$sounds = $renderforestClient->getCompanySounds(15);
3559
```
36-
37-
- The sounds will have greater or equal duration to the specified one.
60+
- These sounds will have greater or equal duration to the specified one.
3861
- **Remember** — any given value of the duration greater than 180 will be overridden by 180!
3962

40-
[See get all sounds example](/examples/sounds/get-all-sounds.php)
63+
[See get company sounds example](/examples/sounds/get-company-sounds.php)
4164

4265

4366
### Get Recommended Sounds
@@ -50,7 +73,7 @@ If the authorization is not present, then response limits to 5.
5073

5174
require '../../vendor/autoload.php';
5275

53-
$sounds = \Renderforest\ApiClient::getRecommendedSoundsLimited(15, 701);
76+
$sounds = \Renderforest\ApiClient::getRecommendedSoundsLimited(701, 15);
5477
```
5578

5679
[See get recommended sounds limited example](/examples/sounds/get-recommended-sounds-limited.php)
@@ -67,7 +90,7 @@ $renderforestClient = new \Renderforest\ApiClient(
6790
'your-client-id'
6891
);
6992

70-
$sounds = $renderforestClient->getRecommendedSounds(15, 701);
93+
$sounds = $renderforestClient->getRecommendedSounds(701, 15);
7194
```
7295
- These sounds will have greater or equal duration to the specified one.
7396
- **Remember** — any given value of the duration greater than 180 will be overridden by 180!
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
require '../../vendor/autoload.php';
4+
5+
$renderforestClient = new \Renderforest\ApiClient(
6+
'your-api-key',
7+
'your-client-id'
8+
);
9+
10+
$projectData = $renderforestClient->getProjectData(24392313);
11+
12+
// Set the screen which snapshot must be returned.
13+
$projectData->setCurrentScreenId(0);
14+
$snapshotUrl = $renderforestClient->getScreenSnapshot($projectData);
15+
16+
echo 'Screen Snapshot - ' . $snapshotUrl . PHP_EOL;

examples/sounds/get-all-sounds.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
require '../../vendor/autoload.php';
4+
5+
$renderforestClient = new \Renderforest\ApiClient(
6+
'your-api-key',
7+
'your-client-id'
8+
);
9+
10+
$sounds = $renderforestClient->getAllSounds();
11+
12+
echo 'Count - ' . count($sounds) . PHP_EOL;
13+
echo PHP_EOL;
14+
15+
foreach ($sounds as $sound) {
16+
echo 'ID - ' . $sound->getId() . PHP_EOL;
17+
echo 'Duration - ' . $sound->getDuration() . PHP_EOL;
18+
echo 'Title - ' . $sound->getTitle() . PHP_EOL;
19+
echo 'Path - ' . $sound->getPath() . PHP_EOL;
20+
21+
echo PHP_EOL;
22+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
require '../../vendor/autoload.php';
4+
5+
//Preferred sound duration
6+
$duration = 5;
7+
8+
$sounds = \Renderforest\ApiClient::getCompanySoundsLimited($duration);
9+
10+
echo 'Count - ' . count($sounds) . PHP_EOL;
11+
echo PHP_EOL;
12+
13+
foreach ($sounds as $sound) {
14+
echo 'ID - ' . $sound->getId() . PHP_EOL;
15+
echo 'Duration - ' . $sound->getDuration() . PHP_EOL;
16+
echo 'Title - ' . $sound->getTitle() . PHP_EOL;
17+
echo 'Path - ' . $sound->getPath() . PHP_EOL;
18+
echo 'Low Quality Path - ' . $sound->getLowQuality() . PHP_EOL;
19+
echo 'Genre - ' . $sound->getGenre() . PHP_EOL;
20+
21+
echo PHP_EOL;
22+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
require '../../vendor/autoload.php';
4+
5+
$renderforestClient = new \Renderforest\ApiClient(
6+
'your-api-key',
7+
'your-client-id'
8+
);
9+
10+
//Preferred sound duration
11+
$duration = 60;
12+
13+
$sounds = $renderforestClient->getCompanySounds($duration);
14+
15+
echo 'Count - ' . count($sounds) . PHP_EOL;
16+
echo PHP_EOL;
17+
18+
foreach ($sounds as $sound) {
19+
echo 'ID - ' . $sound->getId() . PHP_EOL;
20+
echo 'Duration - ' . $sound->getDuration() . PHP_EOL;
21+
echo 'Title - ' . $sound->getTitle() . PHP_EOL;
22+
echo 'Path - ' . $sound->getPath() . PHP_EOL;
23+
echo 'Low Quality Path - ' . $sound->getLowQuality() . PHP_EOL;
24+
echo 'Genre - ' . $sound->getGenre() . PHP_EOL;
25+
26+
echo PHP_EOL;
27+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
require '../../vendor/autoload.php';
4+
5+
$templateId = 701;
6+
//Preferred sound duration
7+
$duration = 60;
8+
9+
$sounds = \Renderforest\ApiClient::getRecommendedSoundsLimited($templateId, $duration);
10+
11+
echo 'Count - ' . count($sounds) . PHP_EOL;
12+
echo PHP_EOL;
13+
14+
foreach ($sounds as $sound) {
15+
echo 'ID - ' . $sound->getId() . PHP_EOL;
16+
echo 'Duration - ' . $sound->getDuration() . PHP_EOL;
17+
echo 'Title - ' . $sound->getTitle() . PHP_EOL;
18+
echo 'Path - ' . $sound->getPath() . PHP_EOL;
19+
echo 'Low Quality Path - ' . $sound->getLowQuality() . PHP_EOL;
20+
echo 'Genre - ' . $sound->getGenre() . PHP_EOL;
21+
22+
echo PHP_EOL;
23+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
require '../../vendor/autoload.php';
4+
5+
$renderforestClient = new \Renderforest\ApiClient(
6+
'your-api-key',
7+
'your-client-id'
8+
);
9+
10+
$templateId = 701;
11+
//Preferred sound duration
12+
$duration = 60;
13+
14+
$sounds = $renderforestClient->getRecommendedSounds($templateId, $duration);
15+
16+
echo 'Count - ' . count($sounds) . PHP_EOL;
17+
echo PHP_EOL;
18+
19+
foreach ($sounds as $sound) {
20+
echo 'ID - ' . $sound->getId() . PHP_EOL;
21+
echo 'Duration - ' . $sound->getDuration() . PHP_EOL;
22+
echo 'Title - ' . $sound->getTitle() . PHP_EOL;
23+
echo 'Path - ' . $sound->getPath() . PHP_EOL;
24+
echo 'Low Quality Path - ' . $sound->getLowQuality() . PHP_EOL;
25+
echo 'Genre - ' . $sound->getGenre() . PHP_EOL;
26+
27+
echo PHP_EOL;
28+
}

0 commit comments

Comments
 (0)