Skip to content

Commit 940d14f

Browse files
Merge pull request #92 from apivideo/add-video-tags-endpoint
Add video tags endpoint
2 parents 654334d + 199c172 commit 940d14f

File tree

12 files changed

+623
-16
lines changed

12 files changed

+623
-16
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
All changes to this project will be documented in this file.
33

4+
## [1.4.3] - 2024-09-30
5+
- Add /tags API endpoint
6+
47
## [1.4.2] - 2024-09-16
58
- Add discarded video endpoints
69

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- [ChaptersApi](#chaptersapi)
2525
- [LiveStreamsApi](#livestreamsapi)
2626
- [PlayerThemesApi](#playerthemesapi)
27+
- [TagsApi](#tagsapi)
2728
- [UploadTokensApi](#uploadtokensapi)
2829
- [VideosApi](#videosapi)
2930
- [WatermarksApi](#watermarksapi)
@@ -185,6 +186,13 @@ Method | Description | HTTP request
185186
[**deleteLogo()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/PlayerThemesApi.md#deleteLogo) | Delete logo | **DELETE** `/players/{playerId}/logo`
186187

187188

189+
#### TagsApi
190+
191+
Method | Description | HTTP request
192+
------------- | ------------- | -------------
193+
[**list()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/TagsApi.md#list) | List all video tags | **GET** `/tags`
194+
195+
188196
#### UploadTokensApi
189197

190198
Method | Description | HTTP request
@@ -263,6 +271,8 @@ Method | Description | HTTP request
263271
- [FilterBy1](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/FilterBy1.md)
264272
- [FilterBy2](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/FilterBy2.md)
265273
- [Link](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/Link.md)
274+
- [ListTagsResponse](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/ListTagsResponse.md)
275+
- [ListTagsResponseData](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/ListTagsResponseData.md)
266276
- [LiveStream](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/LiveStream.md)
267277
- [LiveStreamAssets](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/LiveStreamAssets.md)
268278
- [LiveStreamCreationPayload](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/LiveStreamCreationPayload.md)

docs/Api/TagsApi.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# ApiVideo\Client\Api\TagsApi
2+
3+
All URIs are relative to https://ws.api.video.
4+
5+
Method | Description | HTTP request
6+
------------- | ------------- | -------------
7+
[**list()**](TagsApi.md#list) | List all video tags | **GET** /tags
8+
9+
10+
## **`list()` - List all video tags**
11+
12+
13+
14+
This endpoint enables you to search for video tags in a project and see how many videos are tagged with them. If you do not define any query parameters, the endpoint lists all video tags and the numbers of times they are used in a project.
15+
16+
### Arguments
17+
18+
19+
20+
21+
22+
Note: `queryParams` argument is an associative array with the keys listed below.
23+
24+
Name | Type | Description | Notes
25+
------------- | ------------- | ------------- | -------------
26+
`value` | **string**| Use this parameter to search for specific video tags. The API filters results even on partial values, and ignores accents, uppercase, and lowercase. | [optional]
27+
`sortBy` | **string**| Use this parameter to choose which field the API will use to sort the response data. The default is `value`. These are the available fields to sort by: - `value`: Sorts the results based on tag values in alphabetic order. - `videoCount`: Sorts the results based on the number of times a video tag is used. | [optional]
28+
`sortOrder` | **string**| Use this parameter to sort results. `asc` is ascending and sorts from A to Z. `desc` is descending and sorts from Z to A. | [optional]
29+
`currentPage` | **int**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1]
30+
`pageSize` | **int**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25]
31+
32+
33+
34+
35+
36+
37+
### Return type
38+
39+
[**\ApiVideo\Client\Model\ListTagsResponse**](../Model/ListTagsResponse.md)
40+
41+
42+
43+

docs/Model/ListTagsResponse.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# # ListTagsResponse
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**data** | [**\ApiVideo\Client\Model\ListTagsResponseData[]**](ListTagsResponseData.md) | | [optional]
8+
**pagination** | [**\ApiVideo\Client\Model\Pagination**](Pagination.md) | | [optional]
9+
10+
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

docs/Model/ListTagsResponseData.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# # ListTagsResponseData
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**value** | **string** | Returns the value of a video tag used in your project. | [optional]
8+
**videoCount** | **int** | Returns the number of times a video tag is used. | [optional]
9+
10+
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

docs/Model/Webhook.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**webhookId** | **string** | Unique identifier of the webhook | [optional]
8-
**createdAt** | [**\DateTime**](\DateTime.md) | When an webhook was created, presented in ATOM UTC format. | [optional]
9-
**events** | **string[]** | A list of events that will trigger the webhook. | [optional]
10-
**url** | **string** | URL of the webhook | [optional]
7+
**webhookId** | **string** | A unique identifier of the webhook you subscribed to. | [optional]
8+
**createdAt** | [**\DateTime**](\DateTime.md) | The time and date when you created this webhook subscription, in ATOM UTC format. | [optional]
9+
**events** | **string[]** | A list of events that you subscribed to. When these events occur, the API triggers a webhook call to the URL you provided. | [optional]
10+
**url** | **string** | The URL where the API sends the webhook. | [optional]
11+
**signatureSecret** | **string** | A secret key for the webhook you subscribed to. You can use it to verify the origin of the webhook call that you receive. | [optional]
1112

1213
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

src/Api/TagsApi.php

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
<?php declare(strict_types = 1);
2+
/**
3+
* api.video PHP API client
4+
* api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes.
5+
*
6+
* The version of the OpenAPI document: 1
7+
* Contact: ecosystem@api.video
8+
*
9+
* NOTE: This class is auto generated.
10+
* Do not edit the class manually.
11+
*/
12+
13+
14+
namespace ApiVideo\Client\Api;
15+
16+
use ApiVideo\Client\BaseClient;
17+
use ApiVideo\Client\ModelPreprocessor;
18+
use Exception;
19+
use Http\Message\MultipartStream\MultipartStreamBuilder;
20+
use Psr\Http\Client\ClientExceptionInterface;
21+
use ApiVideo\Client\Request;
22+
use ApiVideo\Client\ObjectSerializer;
23+
use ApiVideo\Client\VideoUploader;
24+
use ApiVideo\Client\ProgressiveUploadSession;
25+
26+
/**
27+
* @category Class
28+
* @package ApiVideo\Client
29+
*/
30+
class TagsApi implements ApiInterface
31+
{
32+
/**
33+
* @var BaseClient
34+
*/
35+
private $client;
36+
37+
/**
38+
* @param BaseClient $client
39+
*/
40+
public function __construct(BaseClient $client)
41+
{
42+
$this->client = $client;
43+
}
44+
45+
/**
46+
* List all video tags
47+
*
48+
* @param array $queryParams
49+
*
50+
* @throws \ApiVideo\Client\ApiException on non-2xx response
51+
* @throws \InvalidArgumentException
52+
* @return \ApiVideo\Client\Model\ListTagsResponse|\ApiVideo\Client\Model\TooManyRequests
53+
*/
54+
public function list(array $queryParams = []): \ApiVideo\Client\Model\ListTagsResponse
55+
{
56+
$request = $this->buildListRequest($queryParams);
57+
58+
$model = new \ApiVideo\Client\Model\ListTagsResponse($this->client->request($request));
59+
60+
return $model;
61+
}
62+
63+
/**
64+
* Create request for operation 'list'
65+
*
66+
* @param array $queryParams
67+
*
68+
* @throws \InvalidArgumentException
69+
* @return Request
70+
*/
71+
private function buildListRequest(array $queryParams = []): Request
72+
{
73+
// unbox the parameters from the associative array
74+
$value = array_key_exists('value', $queryParams) ? $queryParams['value'] : null;
75+
$sortBy = array_key_exists('sortBy', $queryParams) ? $queryParams['sortBy'] : null;
76+
$sortOrder = array_key_exists('sortOrder', $queryParams) ? $queryParams['sortOrder'] : null;
77+
$currentPage = array_key_exists('currentPage', $queryParams) ? $queryParams['currentPage'] : 1;
78+
$pageSize = array_key_exists('pageSize', $queryParams) ? $queryParams['pageSize'] : 25;
79+
80+
81+
$resourcePath = '/tags';
82+
$formParams = [];
83+
$queryParams = [];
84+
$headers = [];
85+
$httpBody = '';
86+
$multipart = false;
87+
88+
// value query params
89+
if ($value !== null) {
90+
$queryParams['value'] = $value;
91+
}
92+
93+
// sortBy query params
94+
if ($sortBy !== null) {
95+
$queryParams['sortBy'] = $sortBy;
96+
}
97+
98+
// sortOrder query params
99+
if ($sortOrder !== null) {
100+
$queryParams['sortOrder'] = $sortOrder;
101+
}
102+
103+
// currentPage query params
104+
if ($currentPage !== null) {
105+
$queryParams['currentPage'] = $currentPage;
106+
}
107+
108+
// pageSize query params
109+
if ($pageSize !== null) {
110+
$queryParams['pageSize'] = $pageSize;
111+
}
112+
113+
114+
115+
116+
$query = \http_build_query($queryParams);
117+
118+
return new Request(
119+
'GET',
120+
$resourcePath . ($query ? "?{$query}" : ''),
121+
$headers,
122+
$httpBody
123+
);
124+
}
125+
126+
127+
}

src/BaseClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function __construct(string $baseUri, ?string $apiKey, ClientInterface $h
7878
$this->originSdkHeaderValue = "";
7979

8080
if ($apiKey) {
81-
$this->authenticator = new Authenticator($this, $apiKey, 'php:1.4.2');
81+
$this->authenticator = new Authenticator($this, $apiKey, 'php:1.4.3');
8282
}
8383
}
8484

@@ -111,7 +111,7 @@ public function request(Request $commandRequest, bool $skipAuthRequest = false):
111111
if($this->originSdkHeaderValue) {
112112
$request = $request->withHeader('AV-Origin-Sdk', $this->originSdkHeaderValue);
113113
}
114-
$request = $request->withHeader('AV-Origin-Client', 'php:1.4.2');
114+
$request = $request->withHeader('AV-Origin-Client', 'php:1.4.3');
115115

116116
return $this->sendRequest($request, $skipAuthRequest);
117117
}

src/Client.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,18 @@ public function playerThemes(): \ApiVideo\Client\Api\PlayerThemesApi
132132
return $this->services['playerThemes'];
133133
}
134134

135+
/**
136+
* @return \ApiVideo\Client\Api\TagsApi
137+
*/
138+
public function tags(): \ApiVideo\Client\Api\TagsApi
139+
{
140+
if (!array_key_exists('tags', $this->services)) {
141+
$this->services['tags'] = new \ApiVideo\Client\Api\TagsApi($this->baseClient);
142+
}
143+
144+
return $this->services['tags'];
145+
}
146+
135147
/**
136148
* @return \ApiVideo\Client\Api\UploadTokensApi
137149
*/

0 commit comments

Comments
 (0)