Skip to content

Commit

Permalink
Add video tags endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierapivideo authored Sep 26, 2024
1 parent 654334d commit 5257acd
Show file tree
Hide file tree
Showing 8 changed files with 557 additions and 0 deletions.
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
37 changes: 37 additions & 0 deletions docs/Api/TagsApi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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



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)
118 changes: 118 additions & 0 deletions src/Api/TagsApi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?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
*
*
* @throws \ApiVideo\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \ApiVideo\Client\Model\ListTagsResponse|\ApiVideo\Client\Model\TooManyRequests
*/
public function list(string $value = null, string $sortBy = null, string $sortOrder = null, int $currentPage = 1, int $pageSize = 25): \ApiVideo\Client\Model\ListTagsResponse
{
$request = $this->buildListRequest();

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

return $model;
}

/**
* Create request for operation 'list'
*
*
* @throws \InvalidArgumentException
* @return Request
*/
private function buildListRequest(string $value = null, string $sortBy = null, string $sortOrder = null, int $currentPage = 1, int $pageSize = 25): Request
{

$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
);
}


}
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 5257acd

Please sign in to comment.