livepeer 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/livepeer.rb +96 -0
- data/lib/sdk/access_control.rb +195 -0
- data/lib/sdk/asset.rb +248 -0
- data/lib/sdk/metrics.rb +158 -0
- data/lib/sdk/models/operations/createmultistreamtarget.rb +34 -0
- data/lib/sdk/models/operations/createsigningkey.rb +35 -0
- data/lib/sdk/models/operations/createstream.rb +34 -0
- data/lib/sdk/models/operations/createwebhook.rb +35 -0
- data/lib/sdk/models/operations/deleteasset.rb +45 -0
- data/lib/sdk/models/operations/deletemultistreamtarget.rb +45 -0
- data/lib/sdk/models/operations/deletesigningkey.rb +45 -0
- data/lib/sdk/models/operations/deletestream.rb +45 -0
- data/lib/sdk/models/operations/deletewebhook.rb +49 -0
- data/lib/sdk/models/operations/get_session_id_clips.rb +48 -0
- data/lib/sdk/models/operations/get_stream_id_clips.rb +48 -0
- data/lib/sdk/models/operations/getasset.rb +49 -0
- data/lib/sdk/models/operations/getassets.rb +34 -0
- data/lib/sdk/models/operations/getcreatormetrics.rb +98 -0
- data/lib/sdk/models/operations/getmultistreamtarget.rb +49 -0
- data/lib/sdk/models/operations/getmultistreamtargets.rb +34 -0
- data/lib/sdk/models/operations/getplaybackinfo.rb +53 -0
- data/lib/sdk/models/operations/getpublictotalviewsmetrics.rb +76 -0
- data/lib/sdk/models/operations/getrecordedsessions.rb +53 -0
- data/lib/sdk/models/operations/getsession.rb +49 -0
- data/lib/sdk/models/operations/getsessions.rb +34 -0
- data/lib/sdk/models/operations/getsigningkey.rb +49 -0
- data/lib/sdk/models/operations/getsigningkeys.rb +34 -0
- data/lib/sdk/models/operations/getstream.rb +49 -0
- data/lib/sdk/models/operations/getstreams.rb +48 -0
- data/lib/sdk/models/operations/gettask.rb +49 -0
- data/lib/sdk/models/operations/gettasks.rb +34 -0
- data/lib/sdk/models/operations/getusagemetrics.rb +72 -0
- data/lib/sdk/models/operations/getviewershipsmetrics.rb +107 -0
- data/lib/sdk/models/operations/getwebhook.rb +49 -0
- data/lib/sdk/models/operations/getwebhooks.rb +34 -0
- data/lib/sdk/models/operations/patch_asset_assetid_.rb +53 -0
- data/lib/sdk/models/operations/post_clip.rb +66 -0
- data/lib/sdk/models/operations/requestupload.rb +72 -0
- data/lib/sdk/models/operations/transcode.rb +35 -0
- data/lib/sdk/models/operations/updatemultistreamtarget.rb +49 -0
- data/lib/sdk/models/operations/updatesigningkey.rb +65 -0
- data/lib/sdk/models/operations/updatestream.rb +49 -0
- data/lib/sdk/models/operations/updatewebhook.rb +49 -0
- data/lib/sdk/models/operations/uploadassetviaurl.rb +66 -0
- data/lib/sdk/models/shared/asset.rb +312 -0
- data/lib/sdk/models/shared/asset_patch_payload.rb +38 -0
- data/lib/sdk/models/shared/attestation.rb +178 -0
- data/lib/sdk/models/shared/clip_payload.rb +37 -0
- data/lib/sdk/models/shared/encryption.rb +25 -0
- data/lib/sdk/models/shared/encryption_output.rb +21 -0
- data/lib/sdk/models/shared/error.rb +25 -0
- data/lib/sdk/models/shared/ffmpeg_profile.rb +71 -0
- data/lib/sdk/models/shared/ipfs_export_params.rb +41 -0
- data/lib/sdk/models/shared/ipfs_file_info.rb +31 -0
- data/lib/sdk/models/shared/multistream.rb +75 -0
- data/lib/sdk/models/shared/multistream_target.rb +36 -0
- data/lib/sdk/models/shared/multistream_target_input.rb +33 -0
- data/lib/sdk/models/shared/multistream_target_patch_payload.rb +33 -0
- data/lib/sdk/models/shared/new_asset_payload.rb +79 -0
- data/lib/sdk/models/shared/new_stream_payload.rb +44 -0
- data/lib/sdk/models/shared/nftmetadata.rb +24 -0
- data/lib/sdk/models/shared/nftmetadatatemplate.rb +23 -0
- data/lib/sdk/models/shared/playback_info.rb +115 -0
- data/lib/sdk/models/shared/playback_policy.rb +41 -0
- data/lib/sdk/models/shared/security.rb +25 -0
- data/lib/sdk/models/shared/session.rb +99 -0
- data/lib/sdk/models/shared/signing_key.rb +40 -0
- data/lib/sdk/models/shared/signing_key_response_payload.rb +43 -0
- data/lib/sdk/models/shared/storage.rb +28 -0
- data/lib/sdk/models/shared/storage_status.rb +70 -0
- data/lib/sdk/models/shared/stream.rb +142 -0
- data/lib/sdk/models/shared/stream_patch_payload.rb +41 -0
- data/lib/sdk/models/shared/task.rb +626 -0
- data/lib/sdk/models/shared/upload.rb +34 -0
- data/lib/sdk/models/shared/upload_output.rb +34 -0
- data/lib/sdk/models/shared/usage_metric.rb +38 -0
- data/lib/sdk/models/shared/viewership_metric.rb +97 -0
- data/lib/sdk/models/shared/webhook.rb +112 -0
- data/lib/sdk/multistream_target.rb +205 -0
- data/lib/sdk/playback.rb +63 -0
- data/lib/sdk/sdk.rb +89 -0
- data/lib/sdk/sdkconfiguration.rb +54 -0
- data/lib/sdk/session.rb +166 -0
- data/lib/sdk/stream.rb +290 -0
- data/lib/sdk/task.rb +87 -0
- data/lib/sdk/transcode.rb +59 -0
- data/lib/sdk/utils/metadata_fields.rb +154 -0
- data/lib/sdk/utils/utils.rb +774 -0
- data/lib/sdk/webhook.rb +192 -0
- metadata +260 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'faraday'
|
7
|
+
require 'faraday/multipart'
|
8
|
+
require 'sorbet-runtime'
|
9
|
+
|
10
|
+
module OpenApiSDK
|
11
|
+
extend T::Sig
|
12
|
+
|
13
|
+
|
14
|
+
SERVERS = [
|
15
|
+
'https://livepeer.studio/api',
|
16
|
+
].freeze
|
17
|
+
# Contains the list of servers available to the SDK
|
18
|
+
|
19
|
+
class SDKConfiguration < OpenApiSDK::Utils::FieldAugmented
|
20
|
+
extend T::Sig
|
21
|
+
|
22
|
+
field :client, T.nilable(Faraday::Connection)
|
23
|
+
field :security, Shared::Security
|
24
|
+
field :server_url, T.nilable(String)
|
25
|
+
field :server, T.nilable(String)
|
26
|
+
field :server_defaults, Array[Hash[Symbol, String]], { 'default_factory': Array}
|
27
|
+
field :language, String
|
28
|
+
field :openapi_doc_version, String
|
29
|
+
field :sdk_version, String
|
30
|
+
field :gen_version, String
|
31
|
+
field :user_agent, String
|
32
|
+
|
33
|
+
|
34
|
+
sig { params(client: Faraday::Connection, security: T.nilable(Shared::Security), server_url: T.nilable(String), server_idx: T.nilable(Integer), server_defaults: T::Array[String], globals: T::Hash[Symbol, T::Hash[Symbol, T::Hash[Symbol, Object]]]).void }
|
35
|
+
def initialize(client, security, server_url, server_idx, server_defaults, globals)
|
36
|
+
@client = client
|
37
|
+
@server_idx = server_idx.nil? ? 0 : server_idx
|
38
|
+
@language = 'ruby'
|
39
|
+
@openapi_doc_version = '1.0.0'
|
40
|
+
@sdk_version = '0.0.1'
|
41
|
+
@gen_version = '2.188.1'
|
42
|
+
@user_agent = 'speakeasy-sdk/ruby 0.0.1 2.188.1 1.0.0 livepeer'
|
43
|
+
end
|
44
|
+
|
45
|
+
sig { returns([String, T::Hash[Symbol, String]]) }
|
46
|
+
def get_server_details
|
47
|
+
return [@server_url.delete_suffix('/'), {}] if !@server_url.nil?
|
48
|
+
@server_idx = 0 if @server_idx.nil?
|
49
|
+
|
50
|
+
|
51
|
+
[SERVERS[@server_idx], {}]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/sdk/session.rb
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'faraday'
|
7
|
+
require 'faraday/multipart'
|
8
|
+
require 'sorbet-runtime'
|
9
|
+
|
10
|
+
module Livepeer
|
11
|
+
extend T::Sig
|
12
|
+
class Session
|
13
|
+
|
14
|
+
extend T::Sig
|
15
|
+
sig { params(sdk_config: SDKConfiguration).void }
|
16
|
+
def initialize(sdk_config)
|
17
|
+
@sdk_configuration = sdk_config
|
18
|
+
end
|
19
|
+
|
20
|
+
sig { returns(Utils::FieldAugmented) }
|
21
|
+
def get_all
|
22
|
+
# get_all - Retrieve sessions
|
23
|
+
url, params = @sdk_configuration.get_server_details
|
24
|
+
base_url = Utils.template_url(url, params)
|
25
|
+
url = "#{base_url}/session"
|
26
|
+
headers = {}
|
27
|
+
headers['Accept'] = 'application/json'
|
28
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
29
|
+
|
30
|
+
r = @sdk_configuration.client.get(url) do |req|
|
31
|
+
req.headers = headers
|
32
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
33
|
+
end
|
34
|
+
|
35
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
36
|
+
|
37
|
+
res = Operations::GetSessionsResponse.new(
|
38
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
39
|
+
)
|
40
|
+
if r.status == 200
|
41
|
+
if Utils.match_content_type(content_type, 'application/json')
|
42
|
+
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::Session])
|
43
|
+
res.data = out
|
44
|
+
end
|
45
|
+
end
|
46
|
+
res
|
47
|
+
end
|
48
|
+
|
49
|
+
sig { params(id: String).returns(Utils::FieldAugmented) }
|
50
|
+
def get(id)
|
51
|
+
# get - Retrieve a session
|
52
|
+
request = Operations::GetSessionRequest.new(
|
53
|
+
|
54
|
+
id: id
|
55
|
+
)
|
56
|
+
url, params = @sdk_configuration.get_server_details
|
57
|
+
base_url = Utils.template_url(url, params)
|
58
|
+
url = Utils.generate_url(
|
59
|
+
Operations::GetSessionRequest,
|
60
|
+
base_url,
|
61
|
+
'/session/{id}',
|
62
|
+
request
|
63
|
+
)
|
64
|
+
headers = {}
|
65
|
+
headers['Accept'] = 'application/json'
|
66
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
67
|
+
|
68
|
+
r = @sdk_configuration.client.get(url) do |req|
|
69
|
+
req.headers = headers
|
70
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
71
|
+
end
|
72
|
+
|
73
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
74
|
+
|
75
|
+
res = Operations::GetSessionResponse.new(
|
76
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
77
|
+
)
|
78
|
+
if r.status == 200
|
79
|
+
if Utils.match_content_type(content_type, 'application/json')
|
80
|
+
out = Utils.unmarshal_complex(r.env.response_body, Shared::Session)
|
81
|
+
res.session = out
|
82
|
+
end
|
83
|
+
end
|
84
|
+
res
|
85
|
+
end
|
86
|
+
|
87
|
+
sig { params(parent_id: String, record: T.nilable(Integer)).returns(Utils::FieldAugmented) }
|
88
|
+
def get_recorded(parent_id, record = nil)
|
89
|
+
# get_recorded - Retrieve Recorded Sessions
|
90
|
+
request = Operations::GetRecordedSessionsRequest.new(
|
91
|
+
|
92
|
+
parent_id: parent_id,
|
93
|
+
record: record
|
94
|
+
)
|
95
|
+
url, params = @sdk_configuration.get_server_details
|
96
|
+
base_url = Utils.template_url(url, params)
|
97
|
+
url = Utils.generate_url(
|
98
|
+
Operations::GetRecordedSessionsRequest,
|
99
|
+
base_url,
|
100
|
+
'/stream/{parentId}/sessions',
|
101
|
+
request
|
102
|
+
)
|
103
|
+
headers = {}
|
104
|
+
query_params = Utils.get_query_params(Operations::GetRecordedSessionsRequest, request)
|
105
|
+
headers['Accept'] = 'application/json'
|
106
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
107
|
+
|
108
|
+
r = @sdk_configuration.client.get(url) do |req|
|
109
|
+
req.headers = headers
|
110
|
+
req.params = query_params
|
111
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
112
|
+
end
|
113
|
+
|
114
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
115
|
+
|
116
|
+
res = Operations::GetRecordedSessionsResponse.new(
|
117
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
118
|
+
)
|
119
|
+
if r.status == 200
|
120
|
+
if Utils.match_content_type(content_type, 'application/json')
|
121
|
+
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::Session])
|
122
|
+
res.data = out
|
123
|
+
end
|
124
|
+
end
|
125
|
+
res
|
126
|
+
end
|
127
|
+
|
128
|
+
sig { params(id: String).returns(Utils::FieldAugmented) }
|
129
|
+
def get_all_clips(id)
|
130
|
+
# get_all_clips - Retrieve clips of a session
|
131
|
+
request = Operations::GetSessionIdClipsRequest.new(
|
132
|
+
|
133
|
+
id: id
|
134
|
+
)
|
135
|
+
url, params = @sdk_configuration.get_server_details
|
136
|
+
base_url = Utils.template_url(url, params)
|
137
|
+
url = Utils.generate_url(
|
138
|
+
Operations::GetSessionIdClipsRequest,
|
139
|
+
base_url,
|
140
|
+
'/session/{id}/clips',
|
141
|
+
request
|
142
|
+
)
|
143
|
+
headers = {}
|
144
|
+
headers['Accept'] = 'application/json'
|
145
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
146
|
+
|
147
|
+
r = @sdk_configuration.client.get(url) do |req|
|
148
|
+
req.headers = headers
|
149
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
150
|
+
end
|
151
|
+
|
152
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
153
|
+
|
154
|
+
res = Operations::GetSessionIdClipsResponse.new(
|
155
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
156
|
+
)
|
157
|
+
if r.status == 200
|
158
|
+
if Utils.match_content_type(content_type, 'application/json')
|
159
|
+
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::Asset])
|
160
|
+
res.data = out
|
161
|
+
end
|
162
|
+
end
|
163
|
+
res
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
data/lib/sdk/stream.rb
ADDED
@@ -0,0 +1,290 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'faraday'
|
7
|
+
require 'faraday/multipart'
|
8
|
+
require 'sorbet-runtime'
|
9
|
+
|
10
|
+
module Livepeer
|
11
|
+
extend T::Sig
|
12
|
+
class Stream
|
13
|
+
|
14
|
+
extend T::Sig
|
15
|
+
sig { params(sdk_config: SDKConfiguration).void }
|
16
|
+
def initialize(sdk_config)
|
17
|
+
@sdk_configuration = sdk_config
|
18
|
+
end
|
19
|
+
|
20
|
+
sig { params(streamsonly: T.nilable(String)).returns(Utils::FieldAugmented) }
|
21
|
+
def get_all(streamsonly = nil)
|
22
|
+
# get_all - Retrieve streams
|
23
|
+
request = Operations::GetStreamsRequest.new(
|
24
|
+
|
25
|
+
streamsonly: streamsonly
|
26
|
+
)
|
27
|
+
url, params = @sdk_configuration.get_server_details
|
28
|
+
base_url = Utils.template_url(url, params)
|
29
|
+
url = "#{base_url}/stream"
|
30
|
+
headers = {}
|
31
|
+
query_params = Utils.get_query_params(Operations::GetStreamsRequest, request)
|
32
|
+
headers['Accept'] = 'application/json'
|
33
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
34
|
+
|
35
|
+
r = @sdk_configuration.client.get(url) do |req|
|
36
|
+
req.headers = headers
|
37
|
+
req.params = query_params
|
38
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
42
|
+
|
43
|
+
res = Operations::GetStreamsResponse.new(
|
44
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
45
|
+
)
|
46
|
+
if r.status == 200
|
47
|
+
if Utils.match_content_type(content_type, 'application/json')
|
48
|
+
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::Stream])
|
49
|
+
res.data = out
|
50
|
+
end
|
51
|
+
end
|
52
|
+
res
|
53
|
+
end
|
54
|
+
|
55
|
+
sig { params(request: Shared::NewStreamPayload).returns(Utils::FieldAugmented) }
|
56
|
+
def create(request)
|
57
|
+
# create - Create a stream
|
58
|
+
url, params = @sdk_configuration.get_server_details
|
59
|
+
base_url = Utils.template_url(url, params)
|
60
|
+
url = "#{base_url}/stream"
|
61
|
+
headers = {}
|
62
|
+
req_content_type, data, form = Utils.serialize_request_body(request, :request, :json)
|
63
|
+
headers['content-type'] = req_content_type
|
64
|
+
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
65
|
+
headers['Accept'] = 'application/json'
|
66
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
67
|
+
|
68
|
+
r = @sdk_configuration.client.post(url) do |req|
|
69
|
+
req.headers = headers
|
70
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
71
|
+
if form
|
72
|
+
req.body = Utils.encode_form(form)
|
73
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
74
|
+
req.body = URI.encode_www_form(data)
|
75
|
+
else
|
76
|
+
req.body = data
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
81
|
+
|
82
|
+
res = Operations::CreateStreamResponse.new(
|
83
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
84
|
+
)
|
85
|
+
if r.status == 200
|
86
|
+
if Utils.match_content_type(content_type, 'application/json')
|
87
|
+
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::Stream])
|
88
|
+
res.data = out
|
89
|
+
end
|
90
|
+
end
|
91
|
+
res
|
92
|
+
end
|
93
|
+
|
94
|
+
sig { params(id: String).returns(Utils::FieldAugmented) }
|
95
|
+
def delete(id)
|
96
|
+
# delete - Delete a stream
|
97
|
+
request = Operations::DeleteStreamRequest.new(
|
98
|
+
|
99
|
+
id: id
|
100
|
+
)
|
101
|
+
url, params = @sdk_configuration.get_server_details
|
102
|
+
base_url = Utils.template_url(url, params)
|
103
|
+
url = Utils.generate_url(
|
104
|
+
Operations::DeleteStreamRequest,
|
105
|
+
base_url,
|
106
|
+
'/stream/{id}',
|
107
|
+
request
|
108
|
+
)
|
109
|
+
headers = {}
|
110
|
+
headers['Accept'] = '*/*'
|
111
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
112
|
+
|
113
|
+
r = @sdk_configuration.client.delete(url) do |req|
|
114
|
+
req.headers = headers
|
115
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
116
|
+
end
|
117
|
+
|
118
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
119
|
+
|
120
|
+
res = Operations::DeleteStreamResponse.new(
|
121
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
122
|
+
)
|
123
|
+
if r.status == 204
|
124
|
+
end
|
125
|
+
res
|
126
|
+
end
|
127
|
+
|
128
|
+
sig { params(id: String).returns(Utils::FieldAugmented) }
|
129
|
+
def get(id)
|
130
|
+
# get - Retrieve a stream
|
131
|
+
request = Operations::GetStreamRequest.new(
|
132
|
+
|
133
|
+
id: id
|
134
|
+
)
|
135
|
+
url, params = @sdk_configuration.get_server_details
|
136
|
+
base_url = Utils.template_url(url, params)
|
137
|
+
url = Utils.generate_url(
|
138
|
+
Operations::GetStreamRequest,
|
139
|
+
base_url,
|
140
|
+
'/stream/{id}',
|
141
|
+
request
|
142
|
+
)
|
143
|
+
headers = {}
|
144
|
+
headers['Accept'] = 'application/json'
|
145
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
146
|
+
|
147
|
+
r = @sdk_configuration.client.get(url) do |req|
|
148
|
+
req.headers = headers
|
149
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
150
|
+
end
|
151
|
+
|
152
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
153
|
+
|
154
|
+
res = Operations::GetStreamResponse.new(
|
155
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
156
|
+
)
|
157
|
+
if r.status == 200
|
158
|
+
if Utils.match_content_type(content_type, 'application/json')
|
159
|
+
out = Utils.unmarshal_complex(r.env.response_body, Shared::Stream)
|
160
|
+
res.stream = out
|
161
|
+
end
|
162
|
+
end
|
163
|
+
res
|
164
|
+
end
|
165
|
+
|
166
|
+
sig { params(id: String, stream_patch_payload: Shared::StreamPatchPayload).returns(Utils::FieldAugmented) }
|
167
|
+
def update(id, stream_patch_payload)
|
168
|
+
# update - Update a stream
|
169
|
+
request = Operations::UpdateStreamRequest.new(
|
170
|
+
|
171
|
+
id: id,
|
172
|
+
stream_patch_payload: stream_patch_payload
|
173
|
+
)
|
174
|
+
url, params = @sdk_configuration.get_server_details
|
175
|
+
base_url = Utils.template_url(url, params)
|
176
|
+
url = Utils.generate_url(
|
177
|
+
Operations::UpdateStreamRequest,
|
178
|
+
base_url,
|
179
|
+
'/stream/{id}',
|
180
|
+
request
|
181
|
+
)
|
182
|
+
headers = {}
|
183
|
+
req_content_type, data, form = Utils.serialize_request_body(request, :stream_patch_payload, :json)
|
184
|
+
headers['content-type'] = req_content_type
|
185
|
+
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
186
|
+
headers['Accept'] = '*/*'
|
187
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
188
|
+
|
189
|
+
r = @sdk_configuration.client.patch(url) do |req|
|
190
|
+
req.headers = headers
|
191
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
192
|
+
if form
|
193
|
+
req.body = Utils.encode_form(form)
|
194
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
195
|
+
req.body = URI.encode_www_form(data)
|
196
|
+
else
|
197
|
+
req.body = data
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
202
|
+
|
203
|
+
res = Operations::UpdateStreamResponse.new(
|
204
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
205
|
+
)
|
206
|
+
if r.status == 204
|
207
|
+
end
|
208
|
+
res
|
209
|
+
end
|
210
|
+
|
211
|
+
sig { params(request: Shared::ClipPayload).returns(Utils::FieldAugmented) }
|
212
|
+
def create_clip(request)
|
213
|
+
# create_clip - Create a clip
|
214
|
+
# Create a clip from a livestream
|
215
|
+
#
|
216
|
+
url, params = @sdk_configuration.get_server_details
|
217
|
+
base_url = Utils.template_url(url, params)
|
218
|
+
url = "#{base_url}/clip"
|
219
|
+
headers = {}
|
220
|
+
req_content_type, data, form = Utils.serialize_request_body(request, :request, :json)
|
221
|
+
headers['content-type'] = req_content_type
|
222
|
+
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
223
|
+
headers['Accept'] = 'application/json'
|
224
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
225
|
+
|
226
|
+
r = @sdk_configuration.client.post(url) do |req|
|
227
|
+
req.headers = headers
|
228
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
229
|
+
if form
|
230
|
+
req.body = Utils.encode_form(form)
|
231
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
232
|
+
req.body = URI.encode_www_form(data)
|
233
|
+
else
|
234
|
+
req.body = data
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
239
|
+
|
240
|
+
res = Operations::PostClipResponse.new(
|
241
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
242
|
+
)
|
243
|
+
if r.status == 200
|
244
|
+
if Utils.match_content_type(content_type, 'application/json')
|
245
|
+
out = Utils.unmarshal_complex(r.env.response_body, Operations::PostClipData)
|
246
|
+
res.data = out
|
247
|
+
end
|
248
|
+
end
|
249
|
+
res
|
250
|
+
end
|
251
|
+
|
252
|
+
sig { params(id: String).returns(Utils::FieldAugmented) }
|
253
|
+
def get_all_clips(id)
|
254
|
+
# get_all_clips - Retrieve clips of a livestream
|
255
|
+
request = Operations::GetStreamIdClipsRequest.new(
|
256
|
+
|
257
|
+
id: id
|
258
|
+
)
|
259
|
+
url, params = @sdk_configuration.get_server_details
|
260
|
+
base_url = Utils.template_url(url, params)
|
261
|
+
url = Utils.generate_url(
|
262
|
+
Operations::GetStreamIdClipsRequest,
|
263
|
+
base_url,
|
264
|
+
'/stream/{id}/clips',
|
265
|
+
request
|
266
|
+
)
|
267
|
+
headers = {}
|
268
|
+
headers['Accept'] = 'application/json'
|
269
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
270
|
+
|
271
|
+
r = @sdk_configuration.client.get(url) do |req|
|
272
|
+
req.headers = headers
|
273
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
274
|
+
end
|
275
|
+
|
276
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
277
|
+
|
278
|
+
res = Operations::GetStreamIdClipsResponse.new(
|
279
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
280
|
+
)
|
281
|
+
if r.status == 200
|
282
|
+
if Utils.match_content_type(content_type, 'application/json')
|
283
|
+
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::Asset])
|
284
|
+
res.data = out
|
285
|
+
end
|
286
|
+
end
|
287
|
+
res
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
data/lib/sdk/task.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'faraday'
|
7
|
+
require 'faraday/multipart'
|
8
|
+
require 'sorbet-runtime'
|
9
|
+
|
10
|
+
module Livepeer
|
11
|
+
extend T::Sig
|
12
|
+
class Task
|
13
|
+
|
14
|
+
extend T::Sig
|
15
|
+
sig { params(sdk_config: SDKConfiguration).void }
|
16
|
+
def initialize(sdk_config)
|
17
|
+
@sdk_configuration = sdk_config
|
18
|
+
end
|
19
|
+
|
20
|
+
sig { returns(Utils::FieldAugmented) }
|
21
|
+
def get_all
|
22
|
+
# get_all - Retrieve Tasks
|
23
|
+
url, params = @sdk_configuration.get_server_details
|
24
|
+
base_url = Utils.template_url(url, params)
|
25
|
+
url = "#{base_url}/task"
|
26
|
+
headers = {}
|
27
|
+
headers['Accept'] = 'application/json'
|
28
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
29
|
+
|
30
|
+
r = @sdk_configuration.client.get(url) do |req|
|
31
|
+
req.headers = headers
|
32
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
33
|
+
end
|
34
|
+
|
35
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
36
|
+
|
37
|
+
res = Operations::GetTasksResponse.new(
|
38
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
39
|
+
)
|
40
|
+
if r.status == 200
|
41
|
+
if Utils.match_content_type(content_type, 'application/json')
|
42
|
+
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::Task])
|
43
|
+
res.data = out
|
44
|
+
end
|
45
|
+
end
|
46
|
+
res
|
47
|
+
end
|
48
|
+
|
49
|
+
sig { params(task_id: String).returns(Utils::FieldAugmented) }
|
50
|
+
def get(task_id)
|
51
|
+
# get - Retrieve a Task
|
52
|
+
request = Operations::GetTaskRequest.new(
|
53
|
+
|
54
|
+
task_id: task_id
|
55
|
+
)
|
56
|
+
url, params = @sdk_configuration.get_server_details
|
57
|
+
base_url = Utils.template_url(url, params)
|
58
|
+
url = Utils.generate_url(
|
59
|
+
Operations::GetTaskRequest,
|
60
|
+
base_url,
|
61
|
+
'/task/{taskId}',
|
62
|
+
request
|
63
|
+
)
|
64
|
+
headers = {}
|
65
|
+
headers['Accept'] = 'application/json'
|
66
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
67
|
+
|
68
|
+
r = @sdk_configuration.client.get(url) do |req|
|
69
|
+
req.headers = headers
|
70
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
71
|
+
end
|
72
|
+
|
73
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
74
|
+
|
75
|
+
res = Operations::GetTaskResponse.new(
|
76
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
77
|
+
)
|
78
|
+
if r.status == 200
|
79
|
+
if Utils.match_content_type(content_type, 'application/json')
|
80
|
+
out = Utils.unmarshal_complex(r.env.response_body, Shared::Task)
|
81
|
+
res.task = out
|
82
|
+
end
|
83
|
+
end
|
84
|
+
res
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'faraday'
|
7
|
+
require 'faraday/multipart'
|
8
|
+
require 'sorbet-runtime'
|
9
|
+
|
10
|
+
module Livepeer
|
11
|
+
extend T::Sig
|
12
|
+
class Transcode
|
13
|
+
|
14
|
+
extend T::Sig
|
15
|
+
sig { params(sdk_config: SDKConfiguration).void }
|
16
|
+
def initialize(sdk_config)
|
17
|
+
@sdk_configuration = sdk_config
|
18
|
+
end
|
19
|
+
|
20
|
+
sig { params(request: Shared::TaskInput).returns(Utils::FieldAugmented) }
|
21
|
+
def create(request)
|
22
|
+
# create - Transcode a video
|
23
|
+
url, params = @sdk_configuration.get_server_details
|
24
|
+
base_url = Utils.template_url(url, params)
|
25
|
+
url = "#{base_url}/transcode"
|
26
|
+
headers = {}
|
27
|
+
req_content_type, data, form = Utils.serialize_request_body(request, :request, :json)
|
28
|
+
headers['content-type'] = req_content_type
|
29
|
+
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
30
|
+
headers['Accept'] = 'application/json'
|
31
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
32
|
+
|
33
|
+
r = @sdk_configuration.client.post(url) do |req|
|
34
|
+
req.headers = headers
|
35
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
36
|
+
if form
|
37
|
+
req.body = Utils.encode_form(form)
|
38
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
39
|
+
req.body = URI.encode_www_form(data)
|
40
|
+
else
|
41
|
+
req.body = data
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
46
|
+
|
47
|
+
res = Operations::TranscodeResponse.new(
|
48
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
49
|
+
)
|
50
|
+
if r.status == 200
|
51
|
+
if Utils.match_content_type(content_type, 'application/json')
|
52
|
+
out = Utils.unmarshal_complex(r.env.response_body, Shared::Task)
|
53
|
+
res.task = out
|
54
|
+
end
|
55
|
+
end
|
56
|
+
res
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|