Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions src/Vimeo/Vimeo.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,101 @@ public function buildAuthorizationEndpoint($redirect_uri, $scope = 'public', $st
return self::AUTH_ENDPOINT . '?' . http_build_query($query);
}

/**
* Get video details.
*/
public function get_video($uri) {
return $this->request($uri, [], 'GET');
}

/**
* Get thumbnail upload link.
* $pictures_uri in the form '/videos/[video id]/pictures'.
*/
public function get_thumbnail_upload_link($pictures_uri) {
return $this->request($pictures_uri, [], 'POST');
}

/**
* PUT a thumbnail.
*/
public function put_thumbnail($url, $thumbnail, $content_type) {
$params[0] = $thumbnail;
$headers['Content-Type'] = $content_type;
return $this->request($url, $params, 'PUT', FALSE, $headers, TRUE);
}

/**
* Set thumbnail active.
*/
public function activate_thumbnail($pictures_uri) {
$params['active'] = true;
return $this->request($pictures_uri, $params, 'PATCH', TRUE);
}

/**
* Search for a video by its name.
*/
public function find_video($name, $page = null) {
$params['query'] = $name;
if ($page !== null) {
$params['page'] = $page;
}
$uri = '/videos';
return $this->request($uri, $params, 'GET');
}

/**
* Get a user's videos.
*/
public function get_videos($user_id, array $params = [], $page = null) {
if ($page !== null) {
$params['page'] = $page;
}
$uri = '/users/' . $user_id . '/videos';
return $this->request($uri, $params, 'GET');
}

/**
* Do a "PULL" upload via a url.
*/
public function pull_upload($url, array $params = array()) {
$params['upload']['approach'] = 'pull';
$params['upload']['link'] = $url;

$uri = '/me/videos';

$attempt = $this->request($uri, $params, 'POST');

return $attempt;
}

/**
* Replace a video's file via pull method.
*/
public function pull_replace($video_id, $file_url, $filename) {
$params = [
'file_name' => $filename,
'upload' => [
'status' => 'in_progress',
'approach' => 'pull',
'link' => $file_url,
],
];

$uri = '/videos/' . $video_id . '/versions';

return $this->request($uri, $params, 'POST', TRUE);
}

/**
* Check transcode status of a uri.
*/
public function check_transcode($uri) {
$response = $this->request($uri . '?fields=transcode.status');
return $response['body']['transcode']['status'];
}

/**
* Upload a file.
*
Expand Down