forked from brightcove/PHP-API-Wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include ingestion api and Profile object
Include ingestion api and Profile object
- Loading branch information
Showing
2 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Brightcove\API; | ||
|
||
use Brightcove\Object\Profile; | ||
|
||
/** | ||
* Class to make requests for Ingestion API. | ||
*/ | ||
class Ingestion extends API { | ||
|
||
/** | ||
* Make a request for the given endpoint. | ||
* | ||
* @param string $method | ||
* HTTP method. | ||
* @param string $endpoint | ||
* Endpoint url. | ||
* @param string $result | ||
* Class name to be used as object for response. | ||
* @param bool $is_array | ||
* Whether the response is an array or not. | ||
* | ||
* @return \Brightcove\Object\ObjectInterface|\Brightcove\Object\ObjectInterface[]|null | ||
* The endpoint result. | ||
* | ||
* @throws \Brightcove\API\Exception\APIException | ||
*/ | ||
protected function ingestionRequest(string $method, string $endpoint, string $result, bool $is_array = FALSE) { | ||
return $this->client->request($method, '1', 'ingestion', $this->account, $endpoint, $result, $is_array); | ||
} | ||
|
||
/** | ||
* Return the profiles available for the account. | ||
* | ||
* @return \Brightcove\Object\ObjectInterface|\Brightcove\Object\ObjectInterface[]|null | ||
* Array of profiles. | ||
* | ||
* @throws \Brightcove\API\Exception\APIException | ||
*/ | ||
public function getProfiles() { | ||
return $this->ingestionRequest('GET', '/profiles', Profile::class, TRUE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<?php | ||
|
||
namespace Brightcove\Object; | ||
|
||
/** | ||
* Class Profile. | ||
* | ||
* @package Brightcove\Object. | ||
* @api | ||
*/ | ||
class Profile extends ObjectBase { | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $id; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $name; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $display_name; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $description; | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function applyJSON(array $json) { | ||
parent::applyJSON($json); | ||
$this->applyProperty($json, 'id'); | ||
$this->applyProperty($json, 'name'); | ||
$this->applyProperty($json, 'display_name'); | ||
$this->applyProperty($json, 'description'); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getId() { | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* @param string $id | ||
* @return Profile | ||
*/ | ||
public function setId($id) { | ||
$this->id = $id; | ||
$this->fieldChanged('src'); | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getName() { | ||
return $this->name; | ||
} | ||
|
||
/** | ||
* @param string $name | ||
* @return Profile | ||
*/ | ||
public function setName(string $name) { | ||
$this->name = $name; | ||
$this->fieldChanged('src'); | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDisplayName() { | ||
return $this->display_name; | ||
} | ||
|
||
/** | ||
* @param string $display_name | ||
* @return Profile | ||
*/ | ||
public function setDisplayName(string $display_name) { | ||
$this->display_name = $display_name; | ||
$this->fieldChanged('src'); | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDescription() { | ||
return $this->description; | ||
} | ||
|
||
/** | ||
* @param string $description | ||
* @return Profile | ||
*/ | ||
public function setDescription(string $description) { | ||
$this->description = $description; | ||
$this->fieldChanged('src'); | ||
return $this; | ||
} | ||
|
||
} |