Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace $lib with $client in examples #304

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Please note that this library requires at least PHP 7.1 installed. If you are on
composer require vimeo/vimeo-api ^2.0
```

2. Use the library `$lib = new \Vimeo\Vimeo($client_id, $client_secret)`.
2. Use the library `$client = new \Vimeo\Vimeo($client_id, $client_secret)`.

## Usage
### Generate your access token
Expand All @@ -72,7 +72,7 @@ Unauthenticated API requests must generate an access token. You should not gener
```php
// `scope` is an array of permissions your token needs to access.
// You can read more at https://developer.vimeo.com/api/authentication#supported-scopes
$token = $lib->clientCredentials(scope);
$token = $client->clientCredentials(scope);

// usable access token
var_dump($token['body']['access_token']);
Expand All @@ -81,15 +81,15 @@ var_dump($token['body']['access_token']);
var_dump($token['body']['scope']);

// use the token
$lib->setToken($token['body']['access_token']);
$client->setToken($token['body']['access_token']);
```

#### Authenticated

1. Build a link to Vimeo so your users can authorize your app.

```php
$url = $lib->buildAuthorizationEndpoint($redirect_uri, $scopes, $state)
$url = $client->buildAuthorizationEndpoint($redirect_uri, $scopes, $state)
```

Name | Type | Description
Expand All @@ -106,7 +106,7 @@ Name | Type | Description

```php
// `redirect_uri` must be provided, and must match your configured URI
$token = $lib->accessToken(code, redirect_uri);
$token = $client->accessToken(code, redirect_uri);

// Usable access token
var_dump($token['body']['access_token']);
Expand All @@ -115,7 +115,7 @@ var_dump($token['body']['access_token']);
var_dump($token['body']['scope']);

// Set the token
$lib->setToken($token['body']['access_token']);
$client->setToken($token['body']['access_token']);
```

For additional information, check out the [example](https://github.com/vimeo/vimeo.php/blob/master/example/auth.php).
Expand All @@ -133,7 +133,7 @@ Name | Type | Description
`method` | string | The HTTP method (e.g.: `GET`).

```php
$response = $lib->request('/me/videos', ['per_page' => 2], 'GET');
$response = $client->request('/me/videos', ['per_page' => 2], 'GET');
```

#### Response
Expand All @@ -147,7 +147,7 @@ Name | Type | Description
`headers` | array | An associative array containing all of the response headers.

```php
$response = $lib->request('/me/videos', ['per_page' => 2], 'GET');
$response = $client->request('/me/videos', ['per_page' => 2], 'GET');
var_dump($response['body']);
```

Expand All @@ -166,10 +166,10 @@ Name | Type | Description
`params` | array | Parameters to send when creating a new video (name, privacy restrictions, etc.). See the [`/me/videos` documentation](https://developer.vimeo.com/api/reference/videos#upload_video) for supported parameters.

```php
$response = $lib->upload('/home/aaron/Downloads/ada.mp4')
$response = $client->upload('/home/aaron/Downloads/ada.mp4')

// With parameters.
$response = $lib->upload('/home/aaron/Downloads/ada.mp4', [
$response = $client->upload('/home/aaron/Downloads/ada.mp4', [
'name' => 'Ada',
'privacy' => [
'view' => 'anybody'
Expand All @@ -187,7 +187,7 @@ Name | Type | Description
`file` | string | Full path to the upload file on the local system.

```php
$response = $lib->replace('/videos/12345', '/home/aaron/Downloads/ada-v2.mp4')
$response = $client->replace('/videos/12345', '/home/aaron/Downloads/ada-v2.mp4')
```

#### Upload or replace videos from the client
Expand All @@ -209,7 +209,7 @@ Read through the [Vimeo documentation](https://developer.vimeo.com/api/upload/vi
Uploading videos from a public URL (also called "pull uploads") uses a single, simple API call.

```php
$video_response = $lib->request(
$video_response = $client->request(
'/me/videos',
[
'upload' => [
Expand All @@ -234,7 +234,7 @@ Name | Type | Description
`activate` | boolean | (Optional) Defaults to `false`. If true, this picture will become the default picture for the associated resource.

```php
$response = $lib->uploadImage('/videos/12345/pictures', '/home/aaron/Downloads/ada.png', true)
$response = $client->uploadImage('/videos/12345/pictures', '/home/aaron/Downloads/ada.png', true)
```

## Troubleshooting
Expand Down