Skip to content

Commit

Permalink
Include ingestion api and Profile object
Browse files Browse the repository at this point in the history
Include ingestion api and Profile object
  • Loading branch information
mariosr66 committed Aug 25, 2021
1 parent 40ee91c commit e5083b2
Show file tree
Hide file tree
Showing 2 changed files with 156 additions and 0 deletions.
44 changes: 44 additions & 0 deletions lib/Brightcove/API/Ingestion.php
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);
}
}
112 changes: 112 additions & 0 deletions lib/Brightcove/Object/Profile.php
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;
}

}

0 comments on commit e5083b2

Please sign in to comment.