faqieh 0.0.1
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 +7 -0
- data/Gemfile +9 -0
- data/LICENSE +21 -0
- data/README.md +173 -0
- data/Rakefile +10 -0
- data/docs/Channel.md +50 -0
- data/docs/ChannelsApi.md +155 -0
- data/docs/DownloadTranscript202Response.md +18 -0
- data/docs/DownloadUrls.md +22 -0
- data/docs/Error.md +18 -0
- data/docs/ErrorError.md +24 -0
- data/docs/FacetOption.md +22 -0
- data/docs/GetChannel200Response.md +18 -0
- data/docs/GetMedium200Response.md +18 -0
- data/docs/GetPlaylist200Response.md +18 -0
- data/docs/GetSpeaker200Response.md +18 -0
- data/docs/GetTranscript200Response.md +20 -0
- data/docs/ListChannels200Response.md +20 -0
- data/docs/ListMedia200Response.md +20 -0
- data/docs/ListPlaylists200Response.md +20 -0
- data/docs/ListSpeakers200Response.md +20 -0
- data/docs/ListTranscripts200Response.md +18 -0
- data/docs/MediaApi.md +161 -0
- data/docs/Medium.md +64 -0
- data/docs/Pagination.md +28 -0
- data/docs/Platform.md +15 -0
- data/docs/Playlist.md +54 -0
- data/docs/PlaylistsApi.md +159 -0
- data/docs/Search200Response.md +20 -0
- data/docs/SearchApi.md +96 -0
- data/docs/SearchSection.md +22 -0
- data/docs/SearchSectionFacets.md +22 -0
- data/docs/Speaker.md +40 -0
- data/docs/SpeakerCountriesInner.md +20 -0
- data/docs/SpeakersApi.md +155 -0
- data/docs/TranscriptDetail.md +28 -0
- data/docs/TranscriptSearchResult.md +42 -0
- data/docs/TranscriptSegment.md +30 -0
- data/docs/TranscriptSummary.md +24 -0
- data/docs/TranscriptsApi.md +222 -0
- data/faqieh.gemspec +41 -0
- data/lib/faqieh/api/channels_api.rb +192 -0
- data/lib/faqieh/api/media_api.rb +200 -0
- data/lib/faqieh/api/playlists_api.rb +198 -0
- data/lib/faqieh/api/search_api.rb +159 -0
- data/lib/faqieh/api/speakers_api.rb +192 -0
- data/lib/faqieh/api/transcripts_api.rb +280 -0
- data/lib/faqieh/api_client.rb +441 -0
- data/lib/faqieh/api_error.rb +58 -0
- data/lib/faqieh/api_model_base.rb +88 -0
- data/lib/faqieh/configuration.rb +385 -0
- data/lib/faqieh/models/channel.rb +340 -0
- data/lib/faqieh/models/download_transcript202_response.rb +188 -0
- data/lib/faqieh/models/download_urls.rb +216 -0
- data/lib/faqieh/models/error.rb +164 -0
- data/lib/faqieh/models/error_error.rb +243 -0
- data/lib/faqieh/models/facet_option.rb +216 -0
- data/lib/faqieh/models/get_channel200_response.rb +164 -0
- data/lib/faqieh/models/get_medium200_response.rb +164 -0
- data/lib/faqieh/models/get_playlist200_response.rb +164 -0
- data/lib/faqieh/models/get_speaker200_response.rb +164 -0
- data/lib/faqieh/models/get_transcript200_response.rb +173 -0
- data/lib/faqieh/models/list_channels200_response.rb +192 -0
- data/lib/faqieh/models/list_media200_response.rb +192 -0
- data/lib/faqieh/models/list_playlists200_response.rb +192 -0
- data/lib/faqieh/models/list_speakers200_response.rb +192 -0
- data/lib/faqieh/models/list_transcripts200_response.rb +166 -0
- data/lib/faqieh/models/medium.rb +412 -0
- data/lib/faqieh/models/pagination.rb +195 -0
- data/lib/faqieh/models/platform.rb +40 -0
- data/lib/faqieh/models/playlist.rb +361 -0
- data/lib/faqieh/models/search200_response.rb +192 -0
- data/lib/faqieh/models/search_section.rb +187 -0
- data/lib/faqieh/models/search_section_facets.rb +243 -0
- data/lib/faqieh/models/speaker.rb +275 -0
- data/lib/faqieh/models/speaker_countries_inner.rb +202 -0
- data/lib/faqieh/models/transcript_detail.rb +297 -0
- data/lib/faqieh/models/transcript_search_result.rb +396 -0
- data/lib/faqieh/models/transcript_segment.rb +222 -0
- data/lib/faqieh/models/transcript_summary.rb +226 -0
- data/lib/faqieh/version.rb +15 -0
- data/lib/faqieh.rb +75 -0
- data/spec/spec_helper.rb +111 -0
- metadata +191 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Faqieh Public API
|
|
3
|
+
|
|
4
|
+
#Public, read-only JSON API for browsing Faqieh's catalog of speakers, channels, playlists, media, and transcripts. Resource responses are JSON wrapped in a `{ \"data\": ... }` envelope. Collections additionally include a `pagination` object and RFC 5988 `Link` headers. Transcript downloads return files, errors use an `{ \"error\": ... }` envelope, and a PDF that is still being prepared returns a JSON `status` object. No authentication is required. Requests are rate limited per IP address: 300 per minute per controller (list/detail share an allowance), with these additional operation limits: - 60 searches per minute, shared across `/search`, catalog `q` searches, transcript searches and the equivalent MCP tools. - 60 paginated transcript reads per minute, shared with MCP `get_transcript`. - 10 exports per minute, shared across `full=true` and TXT/SRT/PDF downloads, regardless of media ID, language or format. With `q`, transcript search takes precedence over `full=true` and uses the search/read allowances. Rate-limit responses include `Retry-After: 60`. ## Conventions - **Pagination:** `?page=` and `?per_page=` (max 100). Search-mode requests (any request with `q`) serve at most 100 pages: deeper `page` values are clamped to 100, and `next_page` / `Link rel=\"next\"` stop at that boundary. Iterate with `next_page` or the `Link` header rather than a self-incremented counter. - **Search:** `?q=` (minimum 3 characters) on each collection, plus the cross-type `/search` endpoint. - **Partial response:** `?fields=a,b` returns only the listed attributes (`id` is always included). - **Embedding:** `?embed=speakers,channels` inlines related resources. - **Resource URLs:** `url` links to the localized Faqieh webpage for speakers, channels, playlists, and media. Channels, playlists, and media also expose `source_url` for the original source; it equals `url` when `platform` is `faqieh`. Clients that used `url` for the source should use `source_url`. Transcript summaries and details include the recording's webpage `url`; transcript segments and transcript search hits include a timestamped `url` pointing to the recording at the segment's start time. - **Localization:** `?locale=ar|en` or the `Accept-Language` header (default `ar`); affects labels and webpage URLs, not search relevance.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.25.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module Faqieh
|
|
16
|
+
class SearchApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Cross-type search preview
|
|
23
|
+
# Searches speakers, channels, playlists, media, and transcript segments. Returns a page of up to 10 results for each requested type. Pass `page` to continue, following each section's `next_page` until null. Restrict types with `?types=`. `speaker_ids[]` / `channel_ids[]` filter the `media`, `playlists`, and `transcripts` sections; `playlist_ids[]` filters `media` and `transcripts`. Ids within one filter are ORed, filters are ANDed. The `speakers` and `channels` sections ignore them. Filter ids are constraints, not resources: unknown or out-of-range ids match nothing instead of returning 404. Each filter accepts at most 100 IDs. Oversized selections are rejected before searching, without truncation. `published_from` / `published_to` filter `media` and `transcripts` by their media publication date. Either inclusive UTC date boundary may be supplied. The other sections ignore them. `duration_min` / `duration_max` filter `media` and `transcripts` by the full recording's duration in whole seconds, with inclusive bounds. Either bound may be omitted. Recordings with unknown durations do not match an active range. The other sections ignore these parameters. Discover filter ids via `/speakers?q=<term>&include_empty=true&fields=id,name`, `/channels?q=<term>&include_empty=true&fields=id,name`, and `/playlists?q=<term>&include_empty=true&fields=id,title` (without `include_empty=true` those endpoints hide zero-hour records that can still appear in facets), or pass `facets=true` for counted options. Each filter's facet options are constrained by the selections in the other filters, never its own — so alternatives within a filter stay visible.
|
|
24
|
+
# @param q [String] Full-text query (minimum 3 searchable characters, maximum 500 characters including whitespace).
|
|
25
|
+
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @option opts [String] :types Comma-separated subset of `speakers,channels,playlists,media,transcripts`. Defaults to all.
|
|
27
|
+
# @option opts [Integer] :page Page number. Search-mode requests (with `q`) are clamped to page 100; `current_page` in the response reflects the served page.
|
|
28
|
+
# @option opts [Array<Integer>] :speaker_ids Only return results linked to any of these speakers.
|
|
29
|
+
# @option opts [Array<Integer>] :channel_ids Only return results linked to any of these channels.
|
|
30
|
+
# @option opts [Array<Integer>] :playlist_ids Only return media and transcript results belonging to any of these playlists. The `playlists` section ignores it.
|
|
31
|
+
# @option opts [Date] :published_from Inclusive earliest media publication date, as a Gregorian `YYYY-MM-DD` UTC calendar date (years 0001-9999). Applies to media and transcripts.
|
|
32
|
+
# @option opts [Date] :published_to Inclusive latest media publication date, as a Gregorian `YYYY-MM-DD` UTC calendar date (years 0001-9999). Applies to media and transcripts.
|
|
33
|
+
# @option opts [Integer] :duration_min Inclusive minimum full recording duration in whole seconds. Applies to media and transcripts. Must be less than or equal to duration_max when both are supplied.
|
|
34
|
+
# @option opts [Integer] :duration_max Inclusive maximum full recording duration in whole seconds. Applies to media and transcripts.
|
|
35
|
+
# @option opts [Boolean] :facets Add per-filter facet options to each filterable section. Up to 50 options ordered by count. Transcript counts are approximate distinct-media counts selected from candidates ranked by matching-segment frequency.
|
|
36
|
+
# @option opts [String] :locale
|
|
37
|
+
# @return [Search200Response]
|
|
38
|
+
def search(q, opts = {})
|
|
39
|
+
data, _status_code, _headers = search_with_http_info(q, opts)
|
|
40
|
+
data
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Cross-type search preview
|
|
44
|
+
# Searches speakers, channels, playlists, media, and transcript segments. Returns a page of up to 10 results for each requested type. Pass `page` to continue, following each section's `next_page` until null. Restrict types with `?types=`. `speaker_ids[]` / `channel_ids[]` filter the `media`, `playlists`, and `transcripts` sections; `playlist_ids[]` filters `media` and `transcripts`. Ids within one filter are ORed, filters are ANDed. The `speakers` and `channels` sections ignore them. Filter ids are constraints, not resources: unknown or out-of-range ids match nothing instead of returning 404. Each filter accepts at most 100 IDs. Oversized selections are rejected before searching, without truncation. `published_from` / `published_to` filter `media` and `transcripts` by their media publication date. Either inclusive UTC date boundary may be supplied. The other sections ignore them. `duration_min` / `duration_max` filter `media` and `transcripts` by the full recording's duration in whole seconds, with inclusive bounds. Either bound may be omitted. Recordings with unknown durations do not match an active range. The other sections ignore these parameters. Discover filter ids via `/speakers?q=<term>&include_empty=true&fields=id,name`, `/channels?q=<term>&include_empty=true&fields=id,name`, and `/playlists?q=<term>&include_empty=true&fields=id,title` (without `include_empty=true` those endpoints hide zero-hour records that can still appear in facets), or pass `facets=true` for counted options. Each filter's facet options are constrained by the selections in the other filters, never its own — so alternatives within a filter stay visible.
|
|
45
|
+
# @param q [String] Full-text query (minimum 3 searchable characters, maximum 500 characters including whitespace).
|
|
46
|
+
# @param [Hash] opts the optional parameters
|
|
47
|
+
# @option opts [String] :types Comma-separated subset of `speakers,channels,playlists,media,transcripts`. Defaults to all.
|
|
48
|
+
# @option opts [Integer] :page Page number. Search-mode requests (with `q`) are clamped to page 100; `current_page` in the response reflects the served page.
|
|
49
|
+
# @option opts [Array<Integer>] :speaker_ids Only return results linked to any of these speakers.
|
|
50
|
+
# @option opts [Array<Integer>] :channel_ids Only return results linked to any of these channels.
|
|
51
|
+
# @option opts [Array<Integer>] :playlist_ids Only return media and transcript results belonging to any of these playlists. The `playlists` section ignores it.
|
|
52
|
+
# @option opts [Date] :published_from Inclusive earliest media publication date, as a Gregorian `YYYY-MM-DD` UTC calendar date (years 0001-9999). Applies to media and transcripts.
|
|
53
|
+
# @option opts [Date] :published_to Inclusive latest media publication date, as a Gregorian `YYYY-MM-DD` UTC calendar date (years 0001-9999). Applies to media and transcripts.
|
|
54
|
+
# @option opts [Integer] :duration_min Inclusive minimum full recording duration in whole seconds. Applies to media and transcripts. Must be less than or equal to duration_max when both are supplied.
|
|
55
|
+
# @option opts [Integer] :duration_max Inclusive maximum full recording duration in whole seconds. Applies to media and transcripts.
|
|
56
|
+
# @option opts [Boolean] :facets Add per-filter facet options to each filterable section. Up to 50 options ordered by count. Transcript counts are approximate distinct-media counts selected from candidates ranked by matching-segment frequency.
|
|
57
|
+
# @option opts [String] :locale
|
|
58
|
+
# @return [Array<(Search200Response, Integer, Hash)>] Search200Response data, response status code and response headers
|
|
59
|
+
def search_with_http_info(q, opts = {})
|
|
60
|
+
if @api_client.config.debugging
|
|
61
|
+
@api_client.config.logger.debug 'Calling API: SearchApi.search ...'
|
|
62
|
+
end
|
|
63
|
+
# verify the required parameter 'q' is set
|
|
64
|
+
if @api_client.config.client_side_validation && q.nil?
|
|
65
|
+
fail ArgumentError, "Missing the required parameter 'q' when calling SearchApi.search"
|
|
66
|
+
end
|
|
67
|
+
if @api_client.config.client_side_validation && q.to_s.length > 500
|
|
68
|
+
fail ArgumentError, 'invalid value for "q" when calling SearchApi.search, the character length must be smaller than or equal to 500.'
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
|
|
72
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling SearchApi.search, must be greater than or equal to 1.'
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
if @api_client.config.client_side_validation && !opts[:'speaker_ids'].nil? && opts[:'speaker_ids'].length > 100
|
|
76
|
+
fail ArgumentError, 'invalid value for "opts[:"speaker_ids"]" when calling SearchApi.search, number of items must be less than or equal to 100.'
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
if @api_client.config.client_side_validation && !opts[:'channel_ids'].nil? && opts[:'channel_ids'].length > 100
|
|
80
|
+
fail ArgumentError, 'invalid value for "opts[:"channel_ids"]" when calling SearchApi.search, number of items must be less than or equal to 100.'
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
if @api_client.config.client_side_validation && !opts[:'playlist_ids'].nil? && opts[:'playlist_ids'].length > 100
|
|
84
|
+
fail ArgumentError, 'invalid value for "opts[:"playlist_ids"]" when calling SearchApi.search, number of items must be less than or equal to 100.'
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
if @api_client.config.client_side_validation && !opts[:'duration_min'].nil? && opts[:'duration_min'] > 2147483647
|
|
88
|
+
fail ArgumentError, 'invalid value for "opts[:"duration_min"]" when calling SearchApi.search, must be smaller than or equal to 2147483647.'
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
if @api_client.config.client_side_validation && !opts[:'duration_min'].nil? && opts[:'duration_min'] < 0
|
|
92
|
+
fail ArgumentError, 'invalid value for "opts[:"duration_min"]" when calling SearchApi.search, must be greater than or equal to 0.'
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
if @api_client.config.client_side_validation && !opts[:'duration_max'].nil? && opts[:'duration_max'] > 2147483647
|
|
96
|
+
fail ArgumentError, 'invalid value for "opts[:"duration_max"]" when calling SearchApi.search, must be smaller than or equal to 2147483647.'
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
if @api_client.config.client_side_validation && !opts[:'duration_max'].nil? && opts[:'duration_max'] < 0
|
|
100
|
+
fail ArgumentError, 'invalid value for "opts[:"duration_max"]" when calling SearchApi.search, must be greater than or equal to 0.'
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
allowable_values = ["ar", "en"]
|
|
104
|
+
if @api_client.config.client_side_validation && opts[:'locale'] && !allowable_values.include?(opts[:'locale'])
|
|
105
|
+
fail ArgumentError, "invalid value for \"locale\", must be one of #{allowable_values}"
|
|
106
|
+
end
|
|
107
|
+
# resource path
|
|
108
|
+
local_var_path = '/search'
|
|
109
|
+
|
|
110
|
+
# query parameters
|
|
111
|
+
query_params = opts[:query_params] || {}
|
|
112
|
+
query_params[:'q'] = q
|
|
113
|
+
query_params[:'types'] = opts[:'types'] if !opts[:'types'].nil?
|
|
114
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
|
115
|
+
query_params[:'speaker_ids[]'] = @api_client.build_collection_param(opts[:'speaker_ids'], :multi) if !opts[:'speaker_ids'].nil?
|
|
116
|
+
query_params[:'channel_ids[]'] = @api_client.build_collection_param(opts[:'channel_ids'], :multi) if !opts[:'channel_ids'].nil?
|
|
117
|
+
query_params[:'playlist_ids[]'] = @api_client.build_collection_param(opts[:'playlist_ids'], :multi) if !opts[:'playlist_ids'].nil?
|
|
118
|
+
query_params[:'published_from'] = opts[:'published_from'] if !opts[:'published_from'].nil?
|
|
119
|
+
query_params[:'published_to'] = opts[:'published_to'] if !opts[:'published_to'].nil?
|
|
120
|
+
query_params[:'duration_min'] = opts[:'duration_min'] if !opts[:'duration_min'].nil?
|
|
121
|
+
query_params[:'duration_max'] = opts[:'duration_max'] if !opts[:'duration_max'].nil?
|
|
122
|
+
query_params[:'facets'] = opts[:'facets'] if !opts[:'facets'].nil?
|
|
123
|
+
query_params[:'locale'] = opts[:'locale'] if !opts[:'locale'].nil?
|
|
124
|
+
|
|
125
|
+
# header parameters
|
|
126
|
+
header_params = opts[:header_params] || {}
|
|
127
|
+
# HTTP header 'Accept' (if needed)
|
|
128
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
129
|
+
|
|
130
|
+
# form parameters
|
|
131
|
+
form_params = opts[:form_params] || {}
|
|
132
|
+
|
|
133
|
+
# http body (model)
|
|
134
|
+
post_body = opts[:debug_body]
|
|
135
|
+
|
|
136
|
+
# return_type
|
|
137
|
+
return_type = opts[:debug_return_type] || 'Search200Response'
|
|
138
|
+
|
|
139
|
+
# auth_names
|
|
140
|
+
auth_names = opts[:debug_auth_names] || []
|
|
141
|
+
|
|
142
|
+
new_options = opts.merge(
|
|
143
|
+
:operation => :"SearchApi.search",
|
|
144
|
+
:header_params => header_params,
|
|
145
|
+
:query_params => query_params,
|
|
146
|
+
:form_params => form_params,
|
|
147
|
+
:body => post_body,
|
|
148
|
+
:auth_names => auth_names,
|
|
149
|
+
:return_type => return_type
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
153
|
+
if @api_client.config.debugging
|
|
154
|
+
@api_client.config.logger.debug "API called: SearchApi#search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
155
|
+
end
|
|
156
|
+
return data, status_code, headers
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Faqieh Public API
|
|
3
|
+
|
|
4
|
+
#Public, read-only JSON API for browsing Faqieh's catalog of speakers, channels, playlists, media, and transcripts. Resource responses are JSON wrapped in a `{ \"data\": ... }` envelope. Collections additionally include a `pagination` object and RFC 5988 `Link` headers. Transcript downloads return files, errors use an `{ \"error\": ... }` envelope, and a PDF that is still being prepared returns a JSON `status` object. No authentication is required. Requests are rate limited per IP address: 300 per minute per controller (list/detail share an allowance), with these additional operation limits: - 60 searches per minute, shared across `/search`, catalog `q` searches, transcript searches and the equivalent MCP tools. - 60 paginated transcript reads per minute, shared with MCP `get_transcript`. - 10 exports per minute, shared across `full=true` and TXT/SRT/PDF downloads, regardless of media ID, language or format. With `q`, transcript search takes precedence over `full=true` and uses the search/read allowances. Rate-limit responses include `Retry-After: 60`. ## Conventions - **Pagination:** `?page=` and `?per_page=` (max 100). Search-mode requests (any request with `q`) serve at most 100 pages: deeper `page` values are clamped to 100, and `next_page` / `Link rel=\"next\"` stop at that boundary. Iterate with `next_page` or the `Link` header rather than a self-incremented counter. - **Search:** `?q=` (minimum 3 characters) on each collection, plus the cross-type `/search` endpoint. - **Partial response:** `?fields=a,b` returns only the listed attributes (`id` is always included). - **Embedding:** `?embed=speakers,channels` inlines related resources. - **Resource URLs:** `url` links to the localized Faqieh webpage for speakers, channels, playlists, and media. Channels, playlists, and media also expose `source_url` for the original source; it equals `url` when `platform` is `faqieh`. Clients that used `url` for the source should use `source_url`. Transcript summaries and details include the recording's webpage `url`; transcript segments and transcript search hits include a timestamped `url` pointing to the recording at the segment's start time. - **Localization:** `?locale=ar|en` or the `Accept-Language` header (default `ar`); affects labels and webpage URLs, not search relevance.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.25.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module Faqieh
|
|
16
|
+
class SpeakersApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Get a speaker
|
|
23
|
+
# @param id [Integer]
|
|
24
|
+
# @param [Hash] opts the optional parameters
|
|
25
|
+
# @option opts [String] :fields Comma-separated attribute whitelist; `id` is always included.
|
|
26
|
+
# @option opts [String] :embed Comma-separated associations to inline (e.g. `speakers,channels`).
|
|
27
|
+
# @option opts [String] :locale
|
|
28
|
+
# @return [GetSpeaker200Response]
|
|
29
|
+
def get_speaker(id, opts = {})
|
|
30
|
+
data, _status_code, _headers = get_speaker_with_http_info(id, opts)
|
|
31
|
+
data
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Get a speaker
|
|
35
|
+
# @param id [Integer]
|
|
36
|
+
# @param [Hash] opts the optional parameters
|
|
37
|
+
# @option opts [String] :fields Comma-separated attribute whitelist; `id` is always included.
|
|
38
|
+
# @option opts [String] :embed Comma-separated associations to inline (e.g. `speakers,channels`).
|
|
39
|
+
# @option opts [String] :locale
|
|
40
|
+
# @return [Array<(GetSpeaker200Response, Integer, Hash)>] GetSpeaker200Response data, response status code and response headers
|
|
41
|
+
def get_speaker_with_http_info(id, opts = {})
|
|
42
|
+
if @api_client.config.debugging
|
|
43
|
+
@api_client.config.logger.debug 'Calling API: SpeakersApi.get_speaker ...'
|
|
44
|
+
end
|
|
45
|
+
# verify the required parameter 'id' is set
|
|
46
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
47
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling SpeakersApi.get_speaker"
|
|
48
|
+
end
|
|
49
|
+
allowable_values = ["ar", "en"]
|
|
50
|
+
if @api_client.config.client_side_validation && opts[:'locale'] && !allowable_values.include?(opts[:'locale'])
|
|
51
|
+
fail ArgumentError, "invalid value for \"locale\", must be one of #{allowable_values}"
|
|
52
|
+
end
|
|
53
|
+
# resource path
|
|
54
|
+
local_var_path = '/speakers/{id}'.sub('{id}', CGI.escape(id.to_s))
|
|
55
|
+
|
|
56
|
+
# query parameters
|
|
57
|
+
query_params = opts[:query_params] || {}
|
|
58
|
+
query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
|
|
59
|
+
query_params[:'embed'] = opts[:'embed'] if !opts[:'embed'].nil?
|
|
60
|
+
query_params[:'locale'] = opts[:'locale'] if !opts[:'locale'].nil?
|
|
61
|
+
|
|
62
|
+
# header parameters
|
|
63
|
+
header_params = opts[:header_params] || {}
|
|
64
|
+
# HTTP header 'Accept' (if needed)
|
|
65
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
66
|
+
|
|
67
|
+
# form parameters
|
|
68
|
+
form_params = opts[:form_params] || {}
|
|
69
|
+
|
|
70
|
+
# http body (model)
|
|
71
|
+
post_body = opts[:debug_body]
|
|
72
|
+
|
|
73
|
+
# return_type
|
|
74
|
+
return_type = opts[:debug_return_type] || 'GetSpeaker200Response'
|
|
75
|
+
|
|
76
|
+
# auth_names
|
|
77
|
+
auth_names = opts[:debug_auth_names] || []
|
|
78
|
+
|
|
79
|
+
new_options = opts.merge(
|
|
80
|
+
:operation => :"SpeakersApi.get_speaker",
|
|
81
|
+
:header_params => header_params,
|
|
82
|
+
:query_params => query_params,
|
|
83
|
+
:form_params => form_params,
|
|
84
|
+
:body => post_body,
|
|
85
|
+
:auth_names => auth_names,
|
|
86
|
+
:return_type => return_type
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
90
|
+
if @api_client.config.debugging
|
|
91
|
+
@api_client.config.logger.debug "API called: SpeakersApi#get_speaker\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
92
|
+
end
|
|
93
|
+
return data, status_code, headers
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# List speakers
|
|
97
|
+
# @param [Hash] opts the optional parameters
|
|
98
|
+
# @option opts [String] :q Full-text query (minimum 3 searchable characters, maximum 500 characters including whitespace).
|
|
99
|
+
# @option opts [Integer] :page Page number. Search-mode requests (with `q`) are clamped to page 100; `current_page` in the response reflects the served page.
|
|
100
|
+
# @option opts [Integer] :per_page (default to 10)
|
|
101
|
+
# @option opts [String] :fields Comma-separated attribute whitelist; `id` is always included.
|
|
102
|
+
# @option opts [String] :embed Comma-separated associations to inline (e.g. `speakers,channels`).
|
|
103
|
+
# @option opts [String] :locale
|
|
104
|
+
# @option opts [Boolean] :include_empty Include speakers, channels, and playlists with no linked media. By default only records with media_count greater than zero are listed.
|
|
105
|
+
# @return [ListSpeakers200Response]
|
|
106
|
+
def list_speakers(opts = {})
|
|
107
|
+
data, _status_code, _headers = list_speakers_with_http_info(opts)
|
|
108
|
+
data
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# List speakers
|
|
112
|
+
# @param [Hash] opts the optional parameters
|
|
113
|
+
# @option opts [String] :q Full-text query (minimum 3 searchable characters, maximum 500 characters including whitespace).
|
|
114
|
+
# @option opts [Integer] :page Page number. Search-mode requests (with `q`) are clamped to page 100; `current_page` in the response reflects the served page.
|
|
115
|
+
# @option opts [Integer] :per_page (default to 10)
|
|
116
|
+
# @option opts [String] :fields Comma-separated attribute whitelist; `id` is always included.
|
|
117
|
+
# @option opts [String] :embed Comma-separated associations to inline (e.g. `speakers,channels`).
|
|
118
|
+
# @option opts [String] :locale
|
|
119
|
+
# @option opts [Boolean] :include_empty Include speakers, channels, and playlists with no linked media. By default only records with media_count greater than zero are listed.
|
|
120
|
+
# @return [Array<(ListSpeakers200Response, Integer, Hash)>] ListSpeakers200Response data, response status code and response headers
|
|
121
|
+
def list_speakers_with_http_info(opts = {})
|
|
122
|
+
if @api_client.config.debugging
|
|
123
|
+
@api_client.config.logger.debug 'Calling API: SpeakersApi.list_speakers ...'
|
|
124
|
+
end
|
|
125
|
+
if @api_client.config.client_side_validation && !opts[:'q'].nil? && opts[:'q'].to_s.length > 500
|
|
126
|
+
fail ArgumentError, 'invalid value for "opts[:"q"]" when calling SpeakersApi.list_speakers, the character length must be smaller than or equal to 500.'
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
|
|
130
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling SpeakersApi.list_speakers, must be greater than or equal to 1.'
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100
|
|
134
|
+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling SpeakersApi.list_speakers, must be smaller than or equal to 100.'
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
|
|
138
|
+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling SpeakersApi.list_speakers, must be greater than or equal to 1.'
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
allowable_values = ["ar", "en"]
|
|
142
|
+
if @api_client.config.client_side_validation && opts[:'locale'] && !allowable_values.include?(opts[:'locale'])
|
|
143
|
+
fail ArgumentError, "invalid value for \"locale\", must be one of #{allowable_values}"
|
|
144
|
+
end
|
|
145
|
+
# resource path
|
|
146
|
+
local_var_path = '/speakers'
|
|
147
|
+
|
|
148
|
+
# query parameters
|
|
149
|
+
query_params = opts[:query_params] || {}
|
|
150
|
+
query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
|
|
151
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
|
152
|
+
query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
|
|
153
|
+
query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
|
|
154
|
+
query_params[:'embed'] = opts[:'embed'] if !opts[:'embed'].nil?
|
|
155
|
+
query_params[:'locale'] = opts[:'locale'] if !opts[:'locale'].nil?
|
|
156
|
+
query_params[:'include_empty'] = opts[:'include_empty'] if !opts[:'include_empty'].nil?
|
|
157
|
+
|
|
158
|
+
# header parameters
|
|
159
|
+
header_params = opts[:header_params] || {}
|
|
160
|
+
# HTTP header 'Accept' (if needed)
|
|
161
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
162
|
+
|
|
163
|
+
# form parameters
|
|
164
|
+
form_params = opts[:form_params] || {}
|
|
165
|
+
|
|
166
|
+
# http body (model)
|
|
167
|
+
post_body = opts[:debug_body]
|
|
168
|
+
|
|
169
|
+
# return_type
|
|
170
|
+
return_type = opts[:debug_return_type] || 'ListSpeakers200Response'
|
|
171
|
+
|
|
172
|
+
# auth_names
|
|
173
|
+
auth_names = opts[:debug_auth_names] || []
|
|
174
|
+
|
|
175
|
+
new_options = opts.merge(
|
|
176
|
+
:operation => :"SpeakersApi.list_speakers",
|
|
177
|
+
:header_params => header_params,
|
|
178
|
+
:query_params => query_params,
|
|
179
|
+
:form_params => form_params,
|
|
180
|
+
:body => post_body,
|
|
181
|
+
:auth_names => auth_names,
|
|
182
|
+
:return_type => return_type
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
186
|
+
if @api_client.config.debugging
|
|
187
|
+
@api_client.config.logger.debug "API called: SpeakersApi#list_speakers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
188
|
+
end
|
|
189
|
+
return data, status_code, headers
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
end
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Faqieh Public API
|
|
3
|
+
|
|
4
|
+
#Public, read-only JSON API for browsing Faqieh's catalog of speakers, channels, playlists, media, and transcripts. Resource responses are JSON wrapped in a `{ \"data\": ... }` envelope. Collections additionally include a `pagination` object and RFC 5988 `Link` headers. Transcript downloads return files, errors use an `{ \"error\": ... }` envelope, and a PDF that is still being prepared returns a JSON `status` object. No authentication is required. Requests are rate limited per IP address: 300 per minute per controller (list/detail share an allowance), with these additional operation limits: - 60 searches per minute, shared across `/search`, catalog `q` searches, transcript searches and the equivalent MCP tools. - 60 paginated transcript reads per minute, shared with MCP `get_transcript`. - 10 exports per minute, shared across `full=true` and TXT/SRT/PDF downloads, regardless of media ID, language or format. With `q`, transcript search takes precedence over `full=true` and uses the search/read allowances. Rate-limit responses include `Retry-After: 60`. ## Conventions - **Pagination:** `?page=` and `?per_page=` (max 100). Search-mode requests (any request with `q`) serve at most 100 pages: deeper `page` values are clamped to 100, and `next_page` / `Link rel=\"next\"` stop at that boundary. Iterate with `next_page` or the `Link` header rather than a self-incremented counter. - **Search:** `?q=` (minimum 3 characters) on each collection, plus the cross-type `/search` endpoint. - **Partial response:** `?fields=a,b` returns only the listed attributes (`id` is always included). - **Embedding:** `?embed=speakers,channels` inlines related resources. - **Resource URLs:** `url` links to the localized Faqieh webpage for speakers, channels, playlists, and media. Channels, playlists, and media also expose `source_url` for the original source; it equals `url` when `platform` is `faqieh`. Clients that used `url` for the source should use `source_url`. Transcript summaries and details include the recording's webpage `url`; transcript segments and transcript search hits include a timestamped `url` pointing to the recording at the segment's start time. - **Localization:** `?locale=ar|en` or the `Accept-Language` header (default `ar`); affects labels and webpage URLs, not search relevance.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.25.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module Faqieh
|
|
16
|
+
class TranscriptsApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Download a transcript as text, SRT, or PDF
|
|
23
|
+
# Text and SRT are generated on the fly. The PDF is rendered asynchronously and cached: when it is not yet ready the endpoint returns `202 Accepted` with a `preparing` status and `Retry-After: 15`. Wait at least 15 seconds before polling. All formats share the 10/minute export allowance with full transcript JSON responses.
|
|
24
|
+
# @param medium_id [Integer]
|
|
25
|
+
# @param language [String] Two-letter language code (e.g. `ar`, `en`).
|
|
26
|
+
# @param format [String] File format.
|
|
27
|
+
# @param [Hash] opts the optional parameters
|
|
28
|
+
# @return [File]
|
|
29
|
+
def download_transcript(medium_id, language, format, opts = {})
|
|
30
|
+
data, _status_code, _headers = download_transcript_with_http_info(medium_id, language, format, opts)
|
|
31
|
+
data
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Download a transcript as text, SRT, or PDF
|
|
35
|
+
# Text and SRT are generated on the fly. The PDF is rendered asynchronously and cached: when it is not yet ready the endpoint returns `202 Accepted` with a `preparing` status and `Retry-After: 15`. Wait at least 15 seconds before polling. All formats share the 10/minute export allowance with full transcript JSON responses.
|
|
36
|
+
# @param medium_id [Integer]
|
|
37
|
+
# @param language [String] Two-letter language code (e.g. `ar`, `en`).
|
|
38
|
+
# @param format [String] File format.
|
|
39
|
+
# @param [Hash] opts the optional parameters
|
|
40
|
+
# @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
|
|
41
|
+
def download_transcript_with_http_info(medium_id, language, format, opts = {})
|
|
42
|
+
if @api_client.config.debugging
|
|
43
|
+
@api_client.config.logger.debug 'Calling API: TranscriptsApi.download_transcript ...'
|
|
44
|
+
end
|
|
45
|
+
# verify the required parameter 'medium_id' is set
|
|
46
|
+
if @api_client.config.client_side_validation && medium_id.nil?
|
|
47
|
+
fail ArgumentError, "Missing the required parameter 'medium_id' when calling TranscriptsApi.download_transcript"
|
|
48
|
+
end
|
|
49
|
+
# verify the required parameter 'language' is set
|
|
50
|
+
if @api_client.config.client_side_validation && language.nil?
|
|
51
|
+
fail ArgumentError, "Missing the required parameter 'language' when calling TranscriptsApi.download_transcript"
|
|
52
|
+
end
|
|
53
|
+
pattern = Regexp.new(/^[a-z]{2}$/)
|
|
54
|
+
if @api_client.config.client_side_validation && language !~ pattern
|
|
55
|
+
fail ArgumentError, "invalid value for 'language' when calling TranscriptsApi.download_transcript, must conform to the pattern #{pattern}."
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# verify the required parameter 'format' is set
|
|
59
|
+
if @api_client.config.client_side_validation && format.nil?
|
|
60
|
+
fail ArgumentError, "Missing the required parameter 'format' when calling TranscriptsApi.download_transcript"
|
|
61
|
+
end
|
|
62
|
+
# verify enum value
|
|
63
|
+
allowable_values = ["txt", "srt", "pdf"]
|
|
64
|
+
if @api_client.config.client_side_validation && !allowable_values.include?(format)
|
|
65
|
+
fail ArgumentError, "invalid value for \"format\", must be one of #{allowable_values}"
|
|
66
|
+
end
|
|
67
|
+
# resource path
|
|
68
|
+
local_var_path = '/media/{medium_id}/transcripts/{language}/download.{format}'.sub('{medium_id}', CGI.escape(medium_id.to_s)).sub('{language}', CGI.escape(language.to_s)).sub('{format}', CGI.escape(format.to_s))
|
|
69
|
+
|
|
70
|
+
# query parameters
|
|
71
|
+
query_params = opts[:query_params] || {}
|
|
72
|
+
|
|
73
|
+
# header parameters
|
|
74
|
+
header_params = opts[:header_params] || {}
|
|
75
|
+
# HTTP header 'Accept' (if needed)
|
|
76
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/pdf', 'application/json']) unless header_params['Accept']
|
|
77
|
+
|
|
78
|
+
# form parameters
|
|
79
|
+
form_params = opts[:form_params] || {}
|
|
80
|
+
|
|
81
|
+
# http body (model)
|
|
82
|
+
post_body = opts[:debug_body]
|
|
83
|
+
|
|
84
|
+
# return_type
|
|
85
|
+
return_type = opts[:debug_return_type] || 'File'
|
|
86
|
+
|
|
87
|
+
# auth_names
|
|
88
|
+
auth_names = opts[:debug_auth_names] || []
|
|
89
|
+
|
|
90
|
+
new_options = opts.merge(
|
|
91
|
+
:operation => :"TranscriptsApi.download_transcript",
|
|
92
|
+
:header_params => header_params,
|
|
93
|
+
:query_params => query_params,
|
|
94
|
+
:form_params => form_params,
|
|
95
|
+
:body => post_body,
|
|
96
|
+
:auth_names => auth_names,
|
|
97
|
+
:return_type => return_type
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
101
|
+
if @api_client.config.debugging
|
|
102
|
+
@api_client.config.logger.debug "API called: TranscriptsApi#download_transcript\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
103
|
+
end
|
|
104
|
+
return data, status_code, headers
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Get a transcript with its segments
|
|
108
|
+
# Segments are paginated by default. Pass `?full=true` to return every segment inline (no `pagination`), or `?q=` to search within the transcript (returns a cursor-style `pagination.next_page`).
|
|
109
|
+
# @param medium_id [Integer]
|
|
110
|
+
# @param language [String] Two-letter language code (e.g. `ar`, `en`).
|
|
111
|
+
# @param [Hash] opts the optional parameters
|
|
112
|
+
# @option opts [String] :q Full-text query (minimum 3 searchable characters, maximum 500 characters including whitespace).
|
|
113
|
+
# @option opts [Integer] :page Page number. Search-mode requests (with `q`) are clamped to page 100; `current_page` in the response reflects the served page.
|
|
114
|
+
# @option opts [Integer] :per_page (default to 10)
|
|
115
|
+
# @option opts [String] :fields Comma-separated attribute whitelist; `id` is always included.
|
|
116
|
+
# @option opts [Boolean] :full Return all segments inline without pagination.
|
|
117
|
+
# @return [GetTranscript200Response]
|
|
118
|
+
def get_transcript(medium_id, language, opts = {})
|
|
119
|
+
data, _status_code, _headers = get_transcript_with_http_info(medium_id, language, opts)
|
|
120
|
+
data
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Get a transcript with its segments
|
|
124
|
+
# Segments are paginated by default. Pass `?full=true` to return every segment inline (no `pagination`), or `?q=` to search within the transcript (returns a cursor-style `pagination.next_page`).
|
|
125
|
+
# @param medium_id [Integer]
|
|
126
|
+
# @param language [String] Two-letter language code (e.g. `ar`, `en`).
|
|
127
|
+
# @param [Hash] opts the optional parameters
|
|
128
|
+
# @option opts [String] :q Full-text query (minimum 3 searchable characters, maximum 500 characters including whitespace).
|
|
129
|
+
# @option opts [Integer] :page Page number. Search-mode requests (with `q`) are clamped to page 100; `current_page` in the response reflects the served page.
|
|
130
|
+
# @option opts [Integer] :per_page (default to 10)
|
|
131
|
+
# @option opts [String] :fields Comma-separated attribute whitelist; `id` is always included.
|
|
132
|
+
# @option opts [Boolean] :full Return all segments inline without pagination.
|
|
133
|
+
# @return [Array<(GetTranscript200Response, Integer, Hash)>] GetTranscript200Response data, response status code and response headers
|
|
134
|
+
def get_transcript_with_http_info(medium_id, language, opts = {})
|
|
135
|
+
if @api_client.config.debugging
|
|
136
|
+
@api_client.config.logger.debug 'Calling API: TranscriptsApi.get_transcript ...'
|
|
137
|
+
end
|
|
138
|
+
# verify the required parameter 'medium_id' is set
|
|
139
|
+
if @api_client.config.client_side_validation && medium_id.nil?
|
|
140
|
+
fail ArgumentError, "Missing the required parameter 'medium_id' when calling TranscriptsApi.get_transcript"
|
|
141
|
+
end
|
|
142
|
+
# verify the required parameter 'language' is set
|
|
143
|
+
if @api_client.config.client_side_validation && language.nil?
|
|
144
|
+
fail ArgumentError, "Missing the required parameter 'language' when calling TranscriptsApi.get_transcript"
|
|
145
|
+
end
|
|
146
|
+
pattern = Regexp.new(/^[a-z]{2}$/)
|
|
147
|
+
if @api_client.config.client_side_validation && language !~ pattern
|
|
148
|
+
fail ArgumentError, "invalid value for 'language' when calling TranscriptsApi.get_transcript, must conform to the pattern #{pattern}."
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
if @api_client.config.client_side_validation && !opts[:'q'].nil? && opts[:'q'].to_s.length > 500
|
|
152
|
+
fail ArgumentError, 'invalid value for "opts[:"q"]" when calling TranscriptsApi.get_transcript, the character length must be smaller than or equal to 500.'
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
|
|
156
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling TranscriptsApi.get_transcript, must be greater than or equal to 1.'
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100
|
|
160
|
+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling TranscriptsApi.get_transcript, must be smaller than or equal to 100.'
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
|
|
164
|
+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling TranscriptsApi.get_transcript, must be greater than or equal to 1.'
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# resource path
|
|
168
|
+
local_var_path = '/media/{medium_id}/transcripts/{language}'.sub('{medium_id}', CGI.escape(medium_id.to_s)).sub('{language}', CGI.escape(language.to_s))
|
|
169
|
+
|
|
170
|
+
# query parameters
|
|
171
|
+
query_params = opts[:query_params] || {}
|
|
172
|
+
query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
|
|
173
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
|
174
|
+
query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
|
|
175
|
+
query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
|
|
176
|
+
query_params[:'full'] = opts[:'full'] if !opts[:'full'].nil?
|
|
177
|
+
|
|
178
|
+
# header parameters
|
|
179
|
+
header_params = opts[:header_params] || {}
|
|
180
|
+
# HTTP header 'Accept' (if needed)
|
|
181
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
182
|
+
|
|
183
|
+
# form parameters
|
|
184
|
+
form_params = opts[:form_params] || {}
|
|
185
|
+
|
|
186
|
+
# http body (model)
|
|
187
|
+
post_body = opts[:debug_body]
|
|
188
|
+
|
|
189
|
+
# return_type
|
|
190
|
+
return_type = opts[:debug_return_type] || 'GetTranscript200Response'
|
|
191
|
+
|
|
192
|
+
# auth_names
|
|
193
|
+
auth_names = opts[:debug_auth_names] || []
|
|
194
|
+
|
|
195
|
+
new_options = opts.merge(
|
|
196
|
+
:operation => :"TranscriptsApi.get_transcript",
|
|
197
|
+
:header_params => header_params,
|
|
198
|
+
:query_params => query_params,
|
|
199
|
+
:form_params => form_params,
|
|
200
|
+
:body => post_body,
|
|
201
|
+
:auth_names => auth_names,
|
|
202
|
+
:return_type => return_type
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
206
|
+
if @api_client.config.debugging
|
|
207
|
+
@api_client.config.logger.debug "API called: TranscriptsApi#get_transcript\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
208
|
+
end
|
|
209
|
+
return data, status_code, headers
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# List a medium's transcripts
|
|
213
|
+
# @param medium_id [Integer]
|
|
214
|
+
# @param [Hash] opts the optional parameters
|
|
215
|
+
# @option opts [String] :locale
|
|
216
|
+
# @return [ListTranscripts200Response]
|
|
217
|
+
def list_transcripts(medium_id, opts = {})
|
|
218
|
+
data, _status_code, _headers = list_transcripts_with_http_info(medium_id, opts)
|
|
219
|
+
data
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# List a medium's transcripts
|
|
223
|
+
# @param medium_id [Integer]
|
|
224
|
+
# @param [Hash] opts the optional parameters
|
|
225
|
+
# @option opts [String] :locale
|
|
226
|
+
# @return [Array<(ListTranscripts200Response, Integer, Hash)>] ListTranscripts200Response data, response status code and response headers
|
|
227
|
+
def list_transcripts_with_http_info(medium_id, opts = {})
|
|
228
|
+
if @api_client.config.debugging
|
|
229
|
+
@api_client.config.logger.debug 'Calling API: TranscriptsApi.list_transcripts ...'
|
|
230
|
+
end
|
|
231
|
+
# verify the required parameter 'medium_id' is set
|
|
232
|
+
if @api_client.config.client_side_validation && medium_id.nil?
|
|
233
|
+
fail ArgumentError, "Missing the required parameter 'medium_id' when calling TranscriptsApi.list_transcripts"
|
|
234
|
+
end
|
|
235
|
+
allowable_values = ["ar", "en"]
|
|
236
|
+
if @api_client.config.client_side_validation && opts[:'locale'] && !allowable_values.include?(opts[:'locale'])
|
|
237
|
+
fail ArgumentError, "invalid value for \"locale\", must be one of #{allowable_values}"
|
|
238
|
+
end
|
|
239
|
+
# resource path
|
|
240
|
+
local_var_path = '/media/{medium_id}/transcripts'.sub('{medium_id}', CGI.escape(medium_id.to_s))
|
|
241
|
+
|
|
242
|
+
# query parameters
|
|
243
|
+
query_params = opts[:query_params] || {}
|
|
244
|
+
query_params[:'locale'] = opts[:'locale'] if !opts[:'locale'].nil?
|
|
245
|
+
|
|
246
|
+
# header parameters
|
|
247
|
+
header_params = opts[:header_params] || {}
|
|
248
|
+
# HTTP header 'Accept' (if needed)
|
|
249
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
250
|
+
|
|
251
|
+
# form parameters
|
|
252
|
+
form_params = opts[:form_params] || {}
|
|
253
|
+
|
|
254
|
+
# http body (model)
|
|
255
|
+
post_body = opts[:debug_body]
|
|
256
|
+
|
|
257
|
+
# return_type
|
|
258
|
+
return_type = opts[:debug_return_type] || 'ListTranscripts200Response'
|
|
259
|
+
|
|
260
|
+
# auth_names
|
|
261
|
+
auth_names = opts[:debug_auth_names] || []
|
|
262
|
+
|
|
263
|
+
new_options = opts.merge(
|
|
264
|
+
:operation => :"TranscriptsApi.list_transcripts",
|
|
265
|
+
:header_params => header_params,
|
|
266
|
+
:query_params => query_params,
|
|
267
|
+
:form_params => form_params,
|
|
268
|
+
:body => post_body,
|
|
269
|
+
:auth_names => auth_names,
|
|
270
|
+
:return_type => return_type
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
274
|
+
if @api_client.config.debugging
|
|
275
|
+
@api_client.config.logger.debug "API called: TranscriptsApi#list_transcripts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
276
|
+
end
|
|
277
|
+
return data, status_code, headers
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
end
|