zernio-sdk 0.0.780 → 0.0.782
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/docs/ConnectApi.md +80 -0
- data/docs/GetYoutubeCaptions200Response.md +38 -0
- data/docs/GetYoutubeCaptions200ResponseAvailableTracksInner.md +24 -0
- data/docs/GetYoutubeCaptions200ResponseCuesInner.md +22 -0
- data/lib/zernio-sdk/api/connect_api.rb +83 -0
- data/lib/zernio-sdk/models/get_youtube_captions200_response.rb +296 -0
- data/lib/zernio-sdk/models/get_youtube_captions200_response_available_tracks_inner.rb +209 -0
- data/lib/zernio-sdk/models/get_youtube_captions200_response_cues_inner.rb +166 -0
- data/lib/zernio-sdk/version.rb +1 -1
- data/lib/zernio-sdk.rb +3 -0
- data/openapi.yaml +116 -0
- data/spec/api/connect_api_spec.rb +16 -0
- data/spec/models/get_youtube_captions200_response_available_tracks_inner_spec.rb +58 -0
- data/spec/models/get_youtube_captions200_response_cues_inner_spec.rb +48 -0
- data/spec/models/get_youtube_captions200_response_spec.rb +104 -0
- metadata +14 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f6cf84a34aa57877a9f48a6addfa1625b2f9e5d3438d8bc88063134ae060f818
|
|
4
|
+
data.tar.gz: 6fcdb8f1265c28c062e6c43ca994486514622ab15e1b6f71b2059ea8aab019d8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 33a39723db63a41bf840c6bfab608f628bed84979b9c703565d595dc1ae7ab8b092696de700c33732949ff30d150696caf617635661487271b45ddfa96c89f3f
|
|
7
|
+
data.tar.gz: bf8c0f80e48a9d9028a6aa09690f4b9e22d9da3ed2d288f4574d58e7b68f3191009a2dc232b3b8a72a2416051495b7d9e70aca7266e849fb9d2771f577b67f1b
|
data/README.md
CHANGED
|
@@ -277,6 +277,7 @@ Class | Method | HTTP request | Description
|
|
|
277
277
|
*Zernio::ConnectApi* | [**get_shopify_connect_url**](docs/ConnectApi.md#get_shopify_connect_url) | **GET** /v1/connect/shopify | Get Shopify OAuth connect URL
|
|
278
278
|
*Zernio::ConnectApi* | [**get_subreddit_rules**](docs/ConnectApi.md#get_subreddit_rules) | **GET** /v1/accounts/{accountId}/reddit-subreddits/{subreddit}/rules | Get subreddit rules
|
|
279
279
|
*Zernio::ConnectApi* | [**get_telegram_connect_status**](docs/ConnectApi.md#get_telegram_connect_status) | **GET** /v1/connect/telegram | Generate Telegram code
|
|
280
|
+
*Zernio::ConnectApi* | [**get_youtube_captions**](docs/ConnectApi.md#get_youtube_captions) | **GET** /v1/accounts/{accountId}/youtube-captions | Get a YouTube video transcript
|
|
280
281
|
*Zernio::ConnectApi* | [**get_youtube_playlists**](docs/ConnectApi.md#get_youtube_playlists) | **GET** /v1/accounts/{accountId}/youtube-playlists | List YouTube playlists
|
|
281
282
|
*Zernio::ConnectApi* | [**handle_o_auth_callback**](docs/ConnectApi.md#handle_o_auth_callback) | **POST** /v1/connect/{platform} | Complete OAuth callback
|
|
282
283
|
*Zernio::ConnectApi* | [**initiate_telegram_connect**](docs/ConnectApi.md#initiate_telegram_connect) | **POST** /v1/connect/telegram | Connect Telegram directly
|
|
@@ -1454,6 +1455,9 @@ Class | Method | HTTP request | Description
|
|
|
1454
1455
|
- [Zernio::GetYouTubeDemographics412Response](docs/GetYouTubeDemographics412Response.md)
|
|
1455
1456
|
- [Zernio::GetYouTubeDemographics412ResponseScopeStatus](docs/GetYouTubeDemographics412ResponseScopeStatus.md)
|
|
1456
1457
|
- [Zernio::GetYouTubeVideoRetention404Response](docs/GetYouTubeVideoRetention404Response.md)
|
|
1458
|
+
- [Zernio::GetYoutubeCaptions200Response](docs/GetYoutubeCaptions200Response.md)
|
|
1459
|
+
- [Zernio::GetYoutubeCaptions200ResponseAvailableTracksInner](docs/GetYoutubeCaptions200ResponseAvailableTracksInner.md)
|
|
1460
|
+
- [Zernio::GetYoutubeCaptions200ResponseCuesInner](docs/GetYoutubeCaptions200ResponseCuesInner.md)
|
|
1457
1461
|
- [Zernio::GetYoutubePlaylists200Response](docs/GetYoutubePlaylists200Response.md)
|
|
1458
1462
|
- [Zernio::GetYoutubePlaylists200ResponsePlaylistsInner](docs/GetYoutubePlaylists200ResponsePlaylistsInner.md)
|
|
1459
1463
|
- [Zernio::GoogleBusinessPlatformData](docs/GoogleBusinessPlatformData.md)
|
data/docs/ConnectApi.md
CHANGED
|
@@ -28,6 +28,7 @@ All URIs are relative to *https://zernio.com/api*
|
|
|
28
28
|
| [**get_shopify_connect_url**](ConnectApi.md#get_shopify_connect_url) | **GET** /v1/connect/shopify | Get Shopify OAuth connect URL |
|
|
29
29
|
| [**get_subreddit_rules**](ConnectApi.md#get_subreddit_rules) | **GET** /v1/accounts/{accountId}/reddit-subreddits/{subreddit}/rules | Get subreddit rules |
|
|
30
30
|
| [**get_telegram_connect_status**](ConnectApi.md#get_telegram_connect_status) | **GET** /v1/connect/telegram | Generate Telegram code |
|
|
31
|
+
| [**get_youtube_captions**](ConnectApi.md#get_youtube_captions) | **GET** /v1/accounts/{accountId}/youtube-captions | Get a YouTube video transcript |
|
|
31
32
|
| [**get_youtube_playlists**](ConnectApi.md#get_youtube_playlists) | **GET** /v1/accounts/{accountId}/youtube-playlists | List YouTube playlists |
|
|
32
33
|
| [**handle_o_auth_callback**](ConnectApi.md#handle_o_auth_callback) | **POST** /v1/connect/{platform} | Complete OAuth callback |
|
|
33
34
|
| [**initiate_telegram_connect**](ConnectApi.md#initiate_telegram_connect) | **POST** /v1/connect/telegram | Connect Telegram directly |
|
|
@@ -1765,6 +1766,85 @@ end
|
|
|
1765
1766
|
- **Accept**: application/json
|
|
1766
1767
|
|
|
1767
1768
|
|
|
1769
|
+
## get_youtube_captions
|
|
1770
|
+
|
|
1771
|
+
> <GetYoutubeCaptions200Response> get_youtube_captions(account_id, video_id, opts)
|
|
1772
|
+
|
|
1773
|
+
Get a YouTube video transcript
|
|
1774
|
+
|
|
1775
|
+
Returns the caption track YouTube already holds for one of the connected channel's own videos, as plain text plus timed cues. Use it instead of downloading and transcribing the video yourself. Auto-generated (ASR) tracks are included: YouTube serves them to the channel owner, which is what the connected account is. Uploaded tracks win over auto-generated ones when both exist for a language. Caching: we store the transcript on first read and serve it from there afterwards, so you do not need to cache it yourself. A cached read costs no YouTube quota and does not call YouTube at all. `source` tells you which happened (`youtube` on the first read, `cache` after). Pass `refresh=true` only when the captions actually changed on YouTube, since that re-downloads. Notes: - Only videos owned by this connected channel. Anything else returns 404. - `contentDetails.caption` in YouTube's own API reads `false` on videos that DO have a serving auto-generated track, so it is not a usable availability signal. Call this endpoint and handle the 404. - YouTube generates auto-captions only for videos with recognisable speech, and can take a few hours after upload to publish them.
|
|
1776
|
+
|
|
1777
|
+
### Examples
|
|
1778
|
+
|
|
1779
|
+
```ruby
|
|
1780
|
+
require 'time'
|
|
1781
|
+
require 'zernio-sdk'
|
|
1782
|
+
# setup authorization
|
|
1783
|
+
Zernio.configure do |config|
|
|
1784
|
+
# Configure Bearer authorization (JWT): bearerAuth
|
|
1785
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
1786
|
+
end
|
|
1787
|
+
|
|
1788
|
+
api_instance = Zernio::ConnectApi.new
|
|
1789
|
+
account_id = 'account_id_example' # String | The connected YouTube account.
|
|
1790
|
+
video_id = 'video_id_example' # String | The YouTube video id (the `platformPostId` on a synced external post).
|
|
1791
|
+
opts = {
|
|
1792
|
+
language: 'language_example', # String | BCP-47 language tag as YouTube labels the track. `en` also matches an `en-GB` track. Omit to take the best available track.
|
|
1793
|
+
format: 'json', # String | `json` returns timed `cues`; `srt` returns the raw SubRip body instead. `text` is present either way.
|
|
1794
|
+
refresh: true # Boolean | Re-download from YouTube instead of serving the stored copy. Spends 200 quota units.
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
begin
|
|
1798
|
+
# Get a YouTube video transcript
|
|
1799
|
+
result = api_instance.get_youtube_captions(account_id, video_id, opts)
|
|
1800
|
+
p result
|
|
1801
|
+
rescue Zernio::ApiError => e
|
|
1802
|
+
puts "Error when calling ConnectApi->get_youtube_captions: #{e}"
|
|
1803
|
+
end
|
|
1804
|
+
```
|
|
1805
|
+
|
|
1806
|
+
#### Using the get_youtube_captions_with_http_info variant
|
|
1807
|
+
|
|
1808
|
+
This returns an Array which contains the response data, status code and headers.
|
|
1809
|
+
|
|
1810
|
+
> <Array(<GetYoutubeCaptions200Response>, Integer, Hash)> get_youtube_captions_with_http_info(account_id, video_id, opts)
|
|
1811
|
+
|
|
1812
|
+
```ruby
|
|
1813
|
+
begin
|
|
1814
|
+
# Get a YouTube video transcript
|
|
1815
|
+
data, status_code, headers = api_instance.get_youtube_captions_with_http_info(account_id, video_id, opts)
|
|
1816
|
+
p status_code # => 2xx
|
|
1817
|
+
p headers # => { ... }
|
|
1818
|
+
p data # => <GetYoutubeCaptions200Response>
|
|
1819
|
+
rescue Zernio::ApiError => e
|
|
1820
|
+
puts "Error when calling ConnectApi->get_youtube_captions_with_http_info: #{e}"
|
|
1821
|
+
end
|
|
1822
|
+
```
|
|
1823
|
+
|
|
1824
|
+
### Parameters
|
|
1825
|
+
|
|
1826
|
+
| Name | Type | Description | Notes |
|
|
1827
|
+
| ---- | ---- | ----------- | ----- |
|
|
1828
|
+
| **account_id** | **String** | The connected YouTube account. | |
|
|
1829
|
+
| **video_id** | **String** | The YouTube video id (the `platformPostId` on a synced external post). | |
|
|
1830
|
+
| **language** | **String** | BCP-47 language tag as YouTube labels the track. `en` also matches an `en-GB` track. Omit to take the best available track. | [optional] |
|
|
1831
|
+
| **format** | **String** | `json` returns timed `cues`; `srt` returns the raw SubRip body instead. `text` is present either way. | [optional][default to 'json'] |
|
|
1832
|
+
| **refresh** | **Boolean** | Re-download from YouTube instead of serving the stored copy. Spends 200 quota units. | [optional][default to false] |
|
|
1833
|
+
|
|
1834
|
+
### Return type
|
|
1835
|
+
|
|
1836
|
+
[**GetYoutubeCaptions200Response**](GetYoutubeCaptions200Response.md)
|
|
1837
|
+
|
|
1838
|
+
### Authorization
|
|
1839
|
+
|
|
1840
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
1841
|
+
|
|
1842
|
+
### HTTP request headers
|
|
1843
|
+
|
|
1844
|
+
- **Content-Type**: Not defined
|
|
1845
|
+
- **Accept**: application/json
|
|
1846
|
+
|
|
1847
|
+
|
|
1768
1848
|
## get_youtube_playlists
|
|
1769
1849
|
|
|
1770
1850
|
> <GetYoutubePlaylists200Response> get_youtube_playlists(account_id)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Zernio::GetYoutubeCaptions200Response
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **account_id** | **String** | | [optional] |
|
|
8
|
+
| **video_id** | **String** | | [optional] |
|
|
9
|
+
| **language** | **String** | The language of the returned track. | [optional] |
|
|
10
|
+
| **track_id** | **String** | YouTube's own caption track id. | [optional] |
|
|
11
|
+
| **track_kind** | **String** | `asr` is YouTube's auto-generated track; `standard` was uploaded by the channel. | [optional] |
|
|
12
|
+
| **source** | **String** | `cache` when served from our stored copy, `youtube` when this call spent the quota units. | [optional] |
|
|
13
|
+
| **fetched_at** | **Time** | When the stored copy was downloaded from YouTube. | [optional] |
|
|
14
|
+
| **text** | **String** | The whole transcript as one paragraph, no timings. | [optional] |
|
|
15
|
+
| **cues** | [**Array<GetYoutubeCaptions200ResponseCuesInner>**](GetYoutubeCaptions200ResponseCuesInner.md) | Timed cues. Present when format is json. Auto-generated cues overlap in time by design (captions roll), so `start` can precede the previous cue's `end`. | [optional] |
|
|
16
|
+
| **srt** | **String** | Raw SubRip body. Present when format is srt. | [optional] |
|
|
17
|
+
| **available_tracks** | [**Array<GetYoutubeCaptions200ResponseAvailableTracksInner>**](GetYoutubeCaptions200ResponseAvailableTracksInner.md) | Every track on the video, so you can re-request another language. On a cached read this is the listing as it stood when we downloaded, so a language added to the video since then appears only after a `refresh=true` or when you request that language directly. | [optional] |
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
require 'zernio-sdk'
|
|
23
|
+
|
|
24
|
+
instance = Zernio::GetYoutubeCaptions200Response.new(
|
|
25
|
+
account_id: null,
|
|
26
|
+
video_id: null,
|
|
27
|
+
language: null,
|
|
28
|
+
track_id: null,
|
|
29
|
+
track_kind: null,
|
|
30
|
+
source: null,
|
|
31
|
+
fetched_at: null,
|
|
32
|
+
text: null,
|
|
33
|
+
cues: null,
|
|
34
|
+
srt: null,
|
|
35
|
+
available_tracks: null
|
|
36
|
+
)
|
|
37
|
+
```
|
|
38
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Zernio::GetYoutubeCaptions200ResponseAvailableTracksInner
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **track_id** | **String** | | [optional] |
|
|
8
|
+
| **language** | **String** | | [optional] |
|
|
9
|
+
| **track_kind** | **String** | | [optional] |
|
|
10
|
+
| **name** | **String** | The track's display name. Empty for auto-generated tracks. | [optional] |
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
require 'zernio-sdk'
|
|
16
|
+
|
|
17
|
+
instance = Zernio::GetYoutubeCaptions200ResponseAvailableTracksInner.new(
|
|
18
|
+
track_id: null,
|
|
19
|
+
language: null,
|
|
20
|
+
track_kind: null,
|
|
21
|
+
name: null
|
|
22
|
+
)
|
|
23
|
+
```
|
|
24
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Zernio::GetYoutubeCaptions200ResponseCuesInner
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **start** | **Float** | Seconds from the start of the video. | [optional] |
|
|
8
|
+
| **_end** | **Float** | | [optional] |
|
|
9
|
+
| **text** | **String** | | [optional] |
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require 'zernio-sdk'
|
|
15
|
+
|
|
16
|
+
instance = Zernio::GetYoutubeCaptions200ResponseCuesInner.new(
|
|
17
|
+
start: null,
|
|
18
|
+
_end: null,
|
|
19
|
+
text: null
|
|
20
|
+
)
|
|
21
|
+
```
|
|
22
|
+
|
|
@@ -1714,6 +1714,89 @@ module Zernio
|
|
|
1714
1714
|
return data, status_code, headers
|
|
1715
1715
|
end
|
|
1716
1716
|
|
|
1717
|
+
# Get a YouTube video transcript
|
|
1718
|
+
# Returns the caption track YouTube already holds for one of the connected channel's own videos, as plain text plus timed cues. Use it instead of downloading and transcribing the video yourself. Auto-generated (ASR) tracks are included: YouTube serves them to the channel owner, which is what the connected account is. Uploaded tracks win over auto-generated ones when both exist for a language. Caching: we store the transcript on first read and serve it from there afterwards, so you do not need to cache it yourself. A cached read costs no YouTube quota and does not call YouTube at all. `source` tells you which happened (`youtube` on the first read, `cache` after). Pass `refresh=true` only when the captions actually changed on YouTube, since that re-downloads. Notes: - Only videos owned by this connected channel. Anything else returns 404. - `contentDetails.caption` in YouTube's own API reads `false` on videos that DO have a serving auto-generated track, so it is not a usable availability signal. Call this endpoint and handle the 404. - YouTube generates auto-captions only for videos with recognisable speech, and can take a few hours after upload to publish them.
|
|
1719
|
+
# @param account_id [String] The connected YouTube account.
|
|
1720
|
+
# @param video_id [String] The YouTube video id (the `platformPostId` on a synced external post).
|
|
1721
|
+
# @param [Hash] opts the optional parameters
|
|
1722
|
+
# @option opts [String] :language BCP-47 language tag as YouTube labels the track. `en` also matches an `en-GB` track. Omit to take the best available track.
|
|
1723
|
+
# @option opts [String] :format `json` returns timed `cues`; `srt` returns the raw SubRip body instead. `text` is present either way. (default to 'json')
|
|
1724
|
+
# @option opts [Boolean] :refresh Re-download from YouTube instead of serving the stored copy. Spends 200 quota units. (default to false)
|
|
1725
|
+
# @return [GetYoutubeCaptions200Response]
|
|
1726
|
+
def get_youtube_captions(account_id, video_id, opts = {})
|
|
1727
|
+
data, _status_code, _headers = get_youtube_captions_with_http_info(account_id, video_id, opts)
|
|
1728
|
+
data
|
|
1729
|
+
end
|
|
1730
|
+
|
|
1731
|
+
# Get a YouTube video transcript
|
|
1732
|
+
# Returns the caption track YouTube already holds for one of the connected channel's own videos, as plain text plus timed cues. Use it instead of downloading and transcribing the video yourself. Auto-generated (ASR) tracks are included: YouTube serves them to the channel owner, which is what the connected account is. Uploaded tracks win over auto-generated ones when both exist for a language. Caching: we store the transcript on first read and serve it from there afterwards, so you do not need to cache it yourself. A cached read costs no YouTube quota and does not call YouTube at all. `source` tells you which happened (`youtube` on the first read, `cache` after). Pass `refresh=true` only when the captions actually changed on YouTube, since that re-downloads. Notes: - Only videos owned by this connected channel. Anything else returns 404. - `contentDetails.caption` in YouTube's own API reads `false` on videos that DO have a serving auto-generated track, so it is not a usable availability signal. Call this endpoint and handle the 404. - YouTube generates auto-captions only for videos with recognisable speech, and can take a few hours after upload to publish them.
|
|
1733
|
+
# @param account_id [String] The connected YouTube account.
|
|
1734
|
+
# @param video_id [String] The YouTube video id (the `platformPostId` on a synced external post).
|
|
1735
|
+
# @param [Hash] opts the optional parameters
|
|
1736
|
+
# @option opts [String] :language BCP-47 language tag as YouTube labels the track. `en` also matches an `en-GB` track. Omit to take the best available track.
|
|
1737
|
+
# @option opts [String] :format `json` returns timed `cues`; `srt` returns the raw SubRip body instead. `text` is present either way. (default to 'json')
|
|
1738
|
+
# @option opts [Boolean] :refresh Re-download from YouTube instead of serving the stored copy. Spends 200 quota units. (default to false)
|
|
1739
|
+
# @return [Array<(GetYoutubeCaptions200Response, Integer, Hash)>] GetYoutubeCaptions200Response data, response status code and response headers
|
|
1740
|
+
def get_youtube_captions_with_http_info(account_id, video_id, opts = {})
|
|
1741
|
+
if @api_client.config.debugging
|
|
1742
|
+
@api_client.config.logger.debug 'Calling API: ConnectApi.get_youtube_captions ...'
|
|
1743
|
+
end
|
|
1744
|
+
# verify the required parameter 'account_id' is set
|
|
1745
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
|
1746
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling ConnectApi.get_youtube_captions"
|
|
1747
|
+
end
|
|
1748
|
+
# verify the required parameter 'video_id' is set
|
|
1749
|
+
if @api_client.config.client_side_validation && video_id.nil?
|
|
1750
|
+
fail ArgumentError, "Missing the required parameter 'video_id' when calling ConnectApi.get_youtube_captions"
|
|
1751
|
+
end
|
|
1752
|
+
allowable_values = ["json", "srt"]
|
|
1753
|
+
if @api_client.config.client_side_validation && opts[:'format'] && !allowable_values.include?(opts[:'format'])
|
|
1754
|
+
fail ArgumentError, "invalid value for \"format\", must be one of #{allowable_values}"
|
|
1755
|
+
end
|
|
1756
|
+
# resource path
|
|
1757
|
+
local_var_path = '/v1/accounts/{accountId}/youtube-captions'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
|
1758
|
+
|
|
1759
|
+
# query parameters
|
|
1760
|
+
query_params = opts[:query_params] || {}
|
|
1761
|
+
query_params[:'videoId'] = video_id
|
|
1762
|
+
query_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
|
1763
|
+
query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
|
|
1764
|
+
query_params[:'refresh'] = opts[:'refresh'] if !opts[:'refresh'].nil?
|
|
1765
|
+
|
|
1766
|
+
# header parameters
|
|
1767
|
+
header_params = opts[:header_params] || {}
|
|
1768
|
+
# HTTP header 'Accept' (if needed)
|
|
1769
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
1770
|
+
|
|
1771
|
+
# form parameters
|
|
1772
|
+
form_params = opts[:form_params] || {}
|
|
1773
|
+
|
|
1774
|
+
# http body (model)
|
|
1775
|
+
post_body = opts[:debug_body]
|
|
1776
|
+
|
|
1777
|
+
# return_type
|
|
1778
|
+
return_type = opts[:debug_return_type] || 'GetYoutubeCaptions200Response'
|
|
1779
|
+
|
|
1780
|
+
# auth_names
|
|
1781
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
1782
|
+
|
|
1783
|
+
new_options = opts.merge(
|
|
1784
|
+
:operation => :"ConnectApi.get_youtube_captions",
|
|
1785
|
+
:header_params => header_params,
|
|
1786
|
+
:query_params => query_params,
|
|
1787
|
+
:form_params => form_params,
|
|
1788
|
+
:body => post_body,
|
|
1789
|
+
:auth_names => auth_names,
|
|
1790
|
+
:return_type => return_type
|
|
1791
|
+
)
|
|
1792
|
+
|
|
1793
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
1794
|
+
if @api_client.config.debugging
|
|
1795
|
+
@api_client.config.logger.debug "API called: ConnectApi#get_youtube_captions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
1796
|
+
end
|
|
1797
|
+
return data, status_code, headers
|
|
1798
|
+
end
|
|
1799
|
+
|
|
1717
1800
|
# List YouTube playlists
|
|
1718
1801
|
# Returns the playlists available for a connected YouTube account. Use this to get a playlist ID when creating a YouTube post with the playlistId field.
|
|
1719
1802
|
# @param account_id [String]
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Zernio API
|
|
3
|
+
|
|
4
|
+
#API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.4
|
|
7
|
+
Contact: support@zernio.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.19.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Zernio
|
|
17
|
+
class GetYoutubeCaptions200Response < ApiModelBase
|
|
18
|
+
attr_accessor :account_id
|
|
19
|
+
|
|
20
|
+
attr_accessor :video_id
|
|
21
|
+
|
|
22
|
+
# The language of the returned track.
|
|
23
|
+
attr_accessor :language
|
|
24
|
+
|
|
25
|
+
# YouTube's own caption track id.
|
|
26
|
+
attr_accessor :track_id
|
|
27
|
+
|
|
28
|
+
# `asr` is YouTube's auto-generated track; `standard` was uploaded by the channel.
|
|
29
|
+
attr_accessor :track_kind
|
|
30
|
+
|
|
31
|
+
# `cache` when served from our stored copy, `youtube` when this call spent the quota units.
|
|
32
|
+
attr_accessor :source
|
|
33
|
+
|
|
34
|
+
# When the stored copy was downloaded from YouTube.
|
|
35
|
+
attr_accessor :fetched_at
|
|
36
|
+
|
|
37
|
+
# The whole transcript as one paragraph, no timings.
|
|
38
|
+
attr_accessor :text
|
|
39
|
+
|
|
40
|
+
# Timed cues. Present when format is json. Auto-generated cues overlap in time by design (captions roll), so `start` can precede the previous cue's `end`.
|
|
41
|
+
attr_accessor :cues
|
|
42
|
+
|
|
43
|
+
# Raw SubRip body. Present when format is srt.
|
|
44
|
+
attr_accessor :srt
|
|
45
|
+
|
|
46
|
+
# Every track on the video, so you can re-request another language. On a cached read this is the listing as it stood when we downloaded, so a language added to the video since then appears only after a `refresh=true` or when you request that language directly.
|
|
47
|
+
attr_accessor :available_tracks
|
|
48
|
+
|
|
49
|
+
class EnumAttributeValidator
|
|
50
|
+
attr_reader :datatype
|
|
51
|
+
attr_reader :allowable_values
|
|
52
|
+
|
|
53
|
+
def initialize(datatype, allowable_values)
|
|
54
|
+
@allowable_values = allowable_values.map do |value|
|
|
55
|
+
case datatype.to_s
|
|
56
|
+
when /Integer/i
|
|
57
|
+
value.to_i
|
|
58
|
+
when /Float/i
|
|
59
|
+
value.to_f
|
|
60
|
+
else
|
|
61
|
+
value
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def valid?(value)
|
|
67
|
+
!value || allowable_values.include?(value)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
72
|
+
def self.attribute_map
|
|
73
|
+
{
|
|
74
|
+
:'account_id' => :'accountId',
|
|
75
|
+
:'video_id' => :'videoId',
|
|
76
|
+
:'language' => :'language',
|
|
77
|
+
:'track_id' => :'trackId',
|
|
78
|
+
:'track_kind' => :'trackKind',
|
|
79
|
+
:'source' => :'source',
|
|
80
|
+
:'fetched_at' => :'fetchedAt',
|
|
81
|
+
:'text' => :'text',
|
|
82
|
+
:'cues' => :'cues',
|
|
83
|
+
:'srt' => :'srt',
|
|
84
|
+
:'available_tracks' => :'availableTracks'
|
|
85
|
+
}
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Returns attribute mapping this model knows about
|
|
89
|
+
def self.acceptable_attribute_map
|
|
90
|
+
attribute_map
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Returns all the JSON keys this model knows about
|
|
94
|
+
def self.acceptable_attributes
|
|
95
|
+
acceptable_attribute_map.values
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Attribute type mapping.
|
|
99
|
+
def self.openapi_types
|
|
100
|
+
{
|
|
101
|
+
:'account_id' => :'String',
|
|
102
|
+
:'video_id' => :'String',
|
|
103
|
+
:'language' => :'String',
|
|
104
|
+
:'track_id' => :'String',
|
|
105
|
+
:'track_kind' => :'String',
|
|
106
|
+
:'source' => :'String',
|
|
107
|
+
:'fetched_at' => :'Time',
|
|
108
|
+
:'text' => :'String',
|
|
109
|
+
:'cues' => :'Array<GetYoutubeCaptions200ResponseCuesInner>',
|
|
110
|
+
:'srt' => :'String',
|
|
111
|
+
:'available_tracks' => :'Array<GetYoutubeCaptions200ResponseAvailableTracksInner>'
|
|
112
|
+
}
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# List of attributes with nullable: true
|
|
116
|
+
def self.openapi_nullable
|
|
117
|
+
Set.new([
|
|
118
|
+
])
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Initializes the object
|
|
122
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
123
|
+
def initialize(attributes = {})
|
|
124
|
+
if (!attributes.is_a?(Hash))
|
|
125
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::GetYoutubeCaptions200Response` initialize method"
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
129
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
130
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
131
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
132
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::GetYoutubeCaptions200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
133
|
+
end
|
|
134
|
+
h[k.to_sym] = v
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if attributes.key?(:'account_id')
|
|
138
|
+
self.account_id = attributes[:'account_id']
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if attributes.key?(:'video_id')
|
|
142
|
+
self.video_id = attributes[:'video_id']
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if attributes.key?(:'language')
|
|
146
|
+
self.language = attributes[:'language']
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if attributes.key?(:'track_id')
|
|
150
|
+
self.track_id = attributes[:'track_id']
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if attributes.key?(:'track_kind')
|
|
154
|
+
self.track_kind = attributes[:'track_kind']
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if attributes.key?(:'source')
|
|
158
|
+
self.source = attributes[:'source']
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if attributes.key?(:'fetched_at')
|
|
162
|
+
self.fetched_at = attributes[:'fetched_at']
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
if attributes.key?(:'text')
|
|
166
|
+
self.text = attributes[:'text']
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
if attributes.key?(:'cues')
|
|
170
|
+
if (value = attributes[:'cues']).is_a?(Array)
|
|
171
|
+
self.cues = value
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
if attributes.key?(:'srt')
|
|
176
|
+
self.srt = attributes[:'srt']
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
if attributes.key?(:'available_tracks')
|
|
180
|
+
if (value = attributes[:'available_tracks']).is_a?(Array)
|
|
181
|
+
self.available_tracks = value
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
187
|
+
# @return Array for valid properties with the reasons
|
|
188
|
+
def list_invalid_properties
|
|
189
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
190
|
+
invalid_properties = Array.new
|
|
191
|
+
invalid_properties
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Check to see if the all the properties in the model are valid
|
|
195
|
+
# @return true if the model is valid
|
|
196
|
+
def valid?
|
|
197
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
198
|
+
track_kind_validator = EnumAttributeValidator.new('String', ["asr", "standard"])
|
|
199
|
+
return false unless track_kind_validator.valid?(@track_kind)
|
|
200
|
+
source_validator = EnumAttributeValidator.new('String', ["cache", "youtube"])
|
|
201
|
+
return false unless source_validator.valid?(@source)
|
|
202
|
+
true
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
206
|
+
# @param [Object] track_kind Object to be assigned
|
|
207
|
+
def track_kind=(track_kind)
|
|
208
|
+
validator = EnumAttributeValidator.new('String', ["asr", "standard"])
|
|
209
|
+
unless validator.valid?(track_kind)
|
|
210
|
+
fail ArgumentError, "invalid value for \"track_kind\", must be one of #{validator.allowable_values}."
|
|
211
|
+
end
|
|
212
|
+
@track_kind = track_kind
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
216
|
+
# @param [Object] source Object to be assigned
|
|
217
|
+
def source=(source)
|
|
218
|
+
validator = EnumAttributeValidator.new('String', ["cache", "youtube"])
|
|
219
|
+
unless validator.valid?(source)
|
|
220
|
+
fail ArgumentError, "invalid value for \"source\", must be one of #{validator.allowable_values}."
|
|
221
|
+
end
|
|
222
|
+
@source = source
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# Checks equality by comparing each attribute.
|
|
226
|
+
# @param [Object] Object to be compared
|
|
227
|
+
def ==(o)
|
|
228
|
+
return true if self.equal?(o)
|
|
229
|
+
self.class == o.class &&
|
|
230
|
+
account_id == o.account_id &&
|
|
231
|
+
video_id == o.video_id &&
|
|
232
|
+
language == o.language &&
|
|
233
|
+
track_id == o.track_id &&
|
|
234
|
+
track_kind == o.track_kind &&
|
|
235
|
+
source == o.source &&
|
|
236
|
+
fetched_at == o.fetched_at &&
|
|
237
|
+
text == o.text &&
|
|
238
|
+
cues == o.cues &&
|
|
239
|
+
srt == o.srt &&
|
|
240
|
+
available_tracks == o.available_tracks
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# @see the `==` method
|
|
244
|
+
# @param [Object] Object to be compared
|
|
245
|
+
def eql?(o)
|
|
246
|
+
self == o
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# Calculates hash code according to all attributes.
|
|
250
|
+
# @return [Integer] Hash code
|
|
251
|
+
def hash
|
|
252
|
+
[account_id, video_id, language, track_id, track_kind, source, fetched_at, text, cues, srt, available_tracks].hash
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# Builds the object from hash
|
|
256
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
257
|
+
# @return [Object] Returns the model itself
|
|
258
|
+
def self.build_from_hash(attributes)
|
|
259
|
+
return nil unless attributes.is_a?(Hash)
|
|
260
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
261
|
+
transformed_hash = {}
|
|
262
|
+
openapi_types.each_pair do |key, type|
|
|
263
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
264
|
+
transformed_hash["#{key}"] = nil
|
|
265
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
266
|
+
# check to ensure the input is an array given that the attribute
|
|
267
|
+
# is documented as an array but the input is not
|
|
268
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
269
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
270
|
+
end
|
|
271
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
272
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
new(transformed_hash)
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
# Returns the object in the form of hash
|
|
279
|
+
# @return [Hash] Returns the object in the form of hash
|
|
280
|
+
def to_hash
|
|
281
|
+
hash = {}
|
|
282
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
283
|
+
value = self.send(attr)
|
|
284
|
+
if value.nil?
|
|
285
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
286
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
hash[param] = _to_hash(value)
|
|
290
|
+
end
|
|
291
|
+
hash
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
end
|