Skip to content

Commit

Permalink
Merge pull request #92 from apivideo/add-video-tags-endpoint
Browse files Browse the repository at this point in the history
Add video tags endpoint
  • Loading branch information
bot-api-video authored Oct 2, 2024
2 parents 654334d + 199c172 commit 940d14f
Show file tree
Hide file tree
Showing 12 changed files with 623 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All changes to this project will be documented in this file.

## [1.4.3] - 2024-09-30
- Add /tags API endpoint

## [1.4.2] - 2024-09-16
- Add discarded video endpoints

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- [ChaptersApi](#chaptersapi)
- [LiveStreamsApi](#livestreamsapi)
- [PlayerThemesApi](#playerthemesapi)
- [TagsApi](#tagsapi)
- [UploadTokensApi](#uploadtokensapi)
- [VideosApi](#videosapi)
- [WatermarksApi](#watermarksapi)
Expand Down Expand Up @@ -185,6 +186,13 @@ Method | Description | HTTP request
[**deleteLogo()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/PlayerThemesApi.md#deleteLogo) | Delete logo | **DELETE** `/players/{playerId}/logo`


#### TagsApi

Method | Description | HTTP request
------------- | ------------- | -------------
[**list()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/TagsApi.md#list) | List all video tags | **GET** `/tags`


#### UploadTokensApi

Method | Description | HTTP request
Expand Down Expand Up @@ -263,6 +271,8 @@ Method | Description | HTTP request
- [FilterBy1](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/FilterBy1.md)
- [FilterBy2](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/FilterBy2.md)
- [Link](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/Link.md)
- [ListTagsResponse](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/ListTagsResponse.md)
- [ListTagsResponseData](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/ListTagsResponseData.md)
- [LiveStream](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/LiveStream.md)
- [LiveStreamAssets](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/LiveStreamAssets.md)
- [LiveStreamCreationPayload](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/LiveStreamCreationPayload.md)
Expand Down
43 changes: 43 additions & 0 deletions docs/Api/TagsApi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# ApiVideo\Client\Api\TagsApi

All URIs are relative to https://ws.api.video.

Method | Description | HTTP request
------------- | ------------- | -------------
[**list()**](TagsApi.md#list) | List all video tags | **GET** /tags


## **`list()` - List all video tags**



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.

### Arguments





Note: `queryParams` argument is an associative array with the keys listed below.

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
`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]
`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]
`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]
`currentPage` | **int**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1]
`pageSize` | **int**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25]






### Return type

[**\ApiVideo\Client\Model\ListTagsResponse**](../Model/ListTagsResponse.md)




10 changes: 10 additions & 0 deletions docs/Model/ListTagsResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# # ListTagsResponse

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**data** | [**\ApiVideo\Client\Model\ListTagsResponseData[]**](ListTagsResponseData.md) | | [optional]
**pagination** | [**\ApiVideo\Client\Model\Pagination**](Pagination.md) | | [optional]

[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
10 changes: 10 additions & 0 deletions docs/Model/ListTagsResponseData.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# # ListTagsResponseData

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **string** | Returns the value of a video tag used in your project. | [optional]
**videoCount** | **int** | Returns the number of times a video tag is used. | [optional]

[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
9 changes: 5 additions & 4 deletions docs/Model/Webhook.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**webhookId** | **string** | Unique identifier of the webhook | [optional]
**createdAt** | [**\DateTime**](\DateTime.md) | When an webhook was created, presented in ATOM UTC format. | [optional]
**events** | **string[]** | A list of events that will trigger the webhook. | [optional]
**url** | **string** | URL of the webhook | [optional]
**webhookId** | **string** | A unique identifier of the webhook you subscribed to. | [optional]
**createdAt** | [**\DateTime**](\DateTime.md) | The time and date when you created this webhook subscription, in ATOM UTC format. | [optional]
**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]
**url** | **string** | The URL where the API sends the webhook. | [optional]
**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]

[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
127 changes: 127 additions & 0 deletions src/Api/TagsApi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?php declare(strict_types = 1);
/**
* api.video PHP API client
* 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.
*
* The version of the OpenAPI document: 1
* Contact: [email protected]
*
* NOTE: This class is auto generated.
* Do not edit the class manually.
*/


namespace ApiVideo\Client\Api;

use ApiVideo\Client\BaseClient;
use ApiVideo\Client\ModelPreprocessor;
use Exception;
use Http\Message\MultipartStream\MultipartStreamBuilder;
use Psr\Http\Client\ClientExceptionInterface;
use ApiVideo\Client\Request;
use ApiVideo\Client\ObjectSerializer;
use ApiVideo\Client\VideoUploader;
use ApiVideo\Client\ProgressiveUploadSession;

/**
* @category Class
* @package ApiVideo\Client
*/
class TagsApi implements ApiInterface
{
/**
* @var BaseClient
*/
private $client;

/**
* @param BaseClient $client
*/
public function __construct(BaseClient $client)
{
$this->client = $client;
}

/**
* List all video tags
*
* @param array $queryParams
*
* @throws \ApiVideo\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \ApiVideo\Client\Model\ListTagsResponse|\ApiVideo\Client\Model\TooManyRequests
*/
public function list(array $queryParams = []): \ApiVideo\Client\Model\ListTagsResponse
{
$request = $this->buildListRequest($queryParams);

$model = new \ApiVideo\Client\Model\ListTagsResponse($this->client->request($request));

return $model;
}

/**
* Create request for operation 'list'
*
* @param array $queryParams
*
* @throws \InvalidArgumentException
* @return Request
*/
private function buildListRequest(array $queryParams = []): Request
{
// unbox the parameters from the associative array
$value = array_key_exists('value', $queryParams) ? $queryParams['value'] : null;
$sortBy = array_key_exists('sortBy', $queryParams) ? $queryParams['sortBy'] : null;
$sortOrder = array_key_exists('sortOrder', $queryParams) ? $queryParams['sortOrder'] : null;
$currentPage = array_key_exists('currentPage', $queryParams) ? $queryParams['currentPage'] : 1;
$pageSize = array_key_exists('pageSize', $queryParams) ? $queryParams['pageSize'] : 25;


$resourcePath = '/tags';
$formParams = [];
$queryParams = [];
$headers = [];
$httpBody = '';
$multipart = false;

// value query params
if ($value !== null) {
$queryParams['value'] = $value;
}

// sortBy query params
if ($sortBy !== null) {
$queryParams['sortBy'] = $sortBy;
}

// sortOrder query params
if ($sortOrder !== null) {
$queryParams['sortOrder'] = $sortOrder;
}

// currentPage query params
if ($currentPage !== null) {
$queryParams['currentPage'] = $currentPage;
}

// pageSize query params
if ($pageSize !== null) {
$queryParams['pageSize'] = $pageSize;
}




$query = \http_build_query($queryParams);

return new Request(
'GET',
$resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}


}
4 changes: 2 additions & 2 deletions src/BaseClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function __construct(string $baseUri, ?string $apiKey, ClientInterface $h
$this->originSdkHeaderValue = "";

if ($apiKey) {
$this->authenticator = new Authenticator($this, $apiKey, 'php:1.4.2');
$this->authenticator = new Authenticator($this, $apiKey, 'php:1.4.3');
}
}

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

return $this->sendRequest($request, $skipAuthRequest);
}
Expand Down
12 changes: 12 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ public function playerThemes(): \ApiVideo\Client\Api\PlayerThemesApi
return $this->services['playerThemes'];
}

/**
* @return \ApiVideo\Client\Api\TagsApi
*/
public function tags(): \ApiVideo\Client\Api\TagsApi
{
if (!array_key_exists('tags', $this->services)) {
$this->services['tags'] = new \ApiVideo\Client\Api\TagsApi($this->baseClient);
}

return $this->services['tags'];
}

/**
* @return \ApiVideo\Client\Api\UploadTokensApi
*/
Expand Down
Loading

0 comments on commit 940d14f

Please sign in to comment.