livepeer 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/livepeer.rb +14 -12
- data/lib/sdk/asset.rb +81 -9
- data/lib/sdk/metrics.rb +12 -4
- data/lib/sdk/models/operations/addmultistreamtarget.rb +49 -0
- data/lib/sdk/models/operations/createsigningkey.rb +5 -5
- data/lib/sdk/models/operations/createstream.rb +4 -4
- data/lib/sdk/models/operations/deletewebhook.rb +1 -1
- data/lib/sdk/models/operations/get_session_id_clips.rb +4 -4
- data/lib/sdk/models/operations/get_stream_id_clips.rb +4 -4
- data/lib/sdk/models/operations/getassets.rb +4 -4
- data/lib/sdk/models/operations/getcreatormetrics.rb +4 -4
- data/lib/sdk/models/operations/getmultistreamtargets.rb +4 -4
- data/lib/sdk/models/operations/getpublictotalviewsmetrics.rb +5 -5
- data/lib/sdk/models/operations/getrecordedsessions.rb +4 -4
- data/lib/sdk/models/operations/getsessions.rb +4 -4
- data/lib/sdk/models/operations/getsigningkeys.rb +4 -4
- data/lib/sdk/models/operations/getstreams.rb +5 -5
- data/lib/sdk/models/operations/gettasks.rb +4 -4
- data/lib/sdk/models/operations/getviewershipsmetrics.rb +4 -4
- data/lib/sdk/models/operations/getwebhook.rb +1 -1
- data/lib/sdk/models/operations/getwebhooks.rb +4 -4
- data/lib/sdk/models/operations/post_clip.rb +5 -5
- data/lib/sdk/models/operations/removemultistreamtarget.rb +48 -0
- data/lib/sdk/models/operations/requestupload.rb +5 -5
- data/lib/sdk/models/operations/terminatestream.rb +45 -0
- data/lib/sdk/models/operations/{patch_asset_assetid_.rb → updateasset.rb} +2 -2
- data/lib/sdk/models/operations/updatewebhook.rb +1 -1
- data/lib/sdk/models/operations/uploadassetviaurl.rb +5 -5
- data/lib/sdk/models/shared/asset.rb +11 -17
- data/lib/sdk/models/shared/attestation.rb +5 -11
- data/lib/sdk/models/shared/encryption.rb +2 -6
- data/lib/sdk/models/shared/ffmpeg_profile.rb +6 -2
- data/lib/sdk/models/shared/ipfs_export_params.rb +5 -16
- data/lib/sdk/models/shared/multistream.rb +2 -50
- data/lib/sdk/models/shared/multistream_target.rb +3 -1
- data/lib/sdk/models/shared/new_asset_payload.rb +8 -3
- data/lib/sdk/models/shared/playback_info.rb +50 -4
- data/lib/sdk/models/shared/session.rb +3 -3
- data/lib/sdk/models/shared/stream.rb +5 -29
- data/lib/sdk/models/shared/stream_patch_payload.rb +5 -2
- data/lib/sdk/models/shared/target.rb +61 -0
- data/lib/sdk/models/shared/target_add_payload.rb +61 -0
- data/lib/sdk/models/shared/target_output.rb +35 -0
- data/lib/sdk/models/shared/task.rb +54 -231
- data/lib/sdk/models/shared/transcode_payload.rb +105 -0
- data/lib/sdk/models/shared/transcode_profile.rb +75 -0
- data/lib/sdk/multistream_target.rb +4 -1
- data/lib/sdk/sdk.rb +33 -3
- data/lib/sdk/sdkconfiguration.rb +3 -3
- data/lib/sdk/session.rb +40 -40
- data/lib/sdk/{access_control.rb → signing_key.rb} +15 -40
- data/lib/sdk/stream.rb +148 -7
- data/lib/sdk/task.rb +1 -1
- data/lib/sdk/transcode.rb +123 -1
- data/lib/sdk/webhook.rb +3 -1
- metadata +17 -15
- data/lib/sdk/models/shared/encryption_output.rb +0 -21
- data/lib/sdk/models/shared/nftmetadata.rb +0 -24
- data/lib/sdk/models/shared/nftmetadatatemplate.rb +0 -23
- data/lib/sdk/models/shared/signing_key_response_payload.rb +0 -43
- data/lib/sdk/models/shared/upload.rb +0 -34
- data/lib/sdk/models/shared/upload_output.rb +0 -34
data/lib/sdk/sdk.rb
CHANGED
@@ -12,7 +12,7 @@ module Livepeer
|
|
12
12
|
class SDK
|
13
13
|
extend T::Sig
|
14
14
|
|
15
|
-
attr_accessor :stream, :multistream_target, :webhook, :asset, :
|
15
|
+
attr_accessor :stream, :multistream_target, :webhook, :asset, :session, :metrics, :signing_key, :task, :transcode, :playback
|
16
16
|
|
17
17
|
attr_accessor :security, :language, :sdk_version, :gen_version
|
18
18
|
|
@@ -78,12 +78,42 @@ module Livepeer
|
|
78
78
|
@multistream_target = MultistreamTarget.new(@sdk_configuration)
|
79
79
|
@webhook = Webhook.new(@sdk_configuration)
|
80
80
|
@asset = Asset.new(@sdk_configuration)
|
81
|
-
@metrics = Metrics.new(@sdk_configuration)
|
82
81
|
@session = Session.new(@sdk_configuration)
|
83
|
-
@
|
82
|
+
@metrics = Metrics.new(@sdk_configuration)
|
83
|
+
@signing_key = SigningKey.new(@sdk_configuration)
|
84
84
|
@task = Task.new(@sdk_configuration)
|
85
85
|
@transcode = Transcode.new(@sdk_configuration)
|
86
86
|
@playback = Playback.new(@sdk_configuration)
|
87
87
|
end
|
88
|
+
|
89
|
+
|
90
|
+
sig { returns(Utils::FieldAugmented) }
|
91
|
+
def get_all
|
92
|
+
# get_all - Retrieves signing keys
|
93
|
+
url, params = @sdk_configuration.get_server_details
|
94
|
+
base_url = Utils.template_url(url, params)
|
95
|
+
url = "#{base_url}/access-control/signing-key"
|
96
|
+
headers = {}
|
97
|
+
headers['Accept'] = 'application/json'
|
98
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
99
|
+
|
100
|
+
r = @sdk_configuration.client.get(url) do |req|
|
101
|
+
req.headers = headers
|
102
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
103
|
+
end
|
104
|
+
|
105
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
106
|
+
|
107
|
+
res = Operations::GetSigningKeysResponse.new(
|
108
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
109
|
+
)
|
110
|
+
if r.status == 200
|
111
|
+
if Utils.match_content_type(content_type, 'application/json')
|
112
|
+
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::SigningKey])
|
113
|
+
res.classes = out
|
114
|
+
end
|
115
|
+
end
|
116
|
+
res
|
117
|
+
end
|
88
118
|
end
|
89
119
|
end
|
data/lib/sdk/sdkconfiguration.rb
CHANGED
@@ -37,9 +37,9 @@ module OpenApiSDK
|
|
37
37
|
@server_idx = server_idx.nil? ? 0 : server_idx
|
38
38
|
@language = 'ruby'
|
39
39
|
@openapi_doc_version = '1.0.0'
|
40
|
-
@sdk_version = '0.0.
|
41
|
-
@gen_version = '2.188.
|
42
|
-
@user_agent = 'speakeasy-sdk/ruby 0.0.
|
40
|
+
@sdk_version = '0.0.2'
|
41
|
+
@gen_version = '2.188.3'
|
42
|
+
@user_agent = 'speakeasy-sdk/ruby 0.0.2 2.188.3 1.0.0 livepeer'
|
43
43
|
end
|
44
44
|
|
45
45
|
sig { returns([String, T::Hash[Symbol, String]]) }
|
data/lib/sdk/session.rb
CHANGED
@@ -17,6 +17,44 @@ module Livepeer
|
|
17
17
|
@sdk_configuration = sdk_config
|
18
18
|
end
|
19
19
|
|
20
|
+
sig { params(id: String).returns(Utils::FieldAugmented) }
|
21
|
+
def get_all_clips(id)
|
22
|
+
# get_all_clips - Retrieve clips of a session
|
23
|
+
request = Operations::GetSessionIdClipsRequest.new(
|
24
|
+
|
25
|
+
id: id
|
26
|
+
)
|
27
|
+
url, params = @sdk_configuration.get_server_details
|
28
|
+
base_url = Utils.template_url(url, params)
|
29
|
+
url = Utils.generate_url(
|
30
|
+
Operations::GetSessionIdClipsRequest,
|
31
|
+
base_url,
|
32
|
+
'/session/{id}/clips',
|
33
|
+
request
|
34
|
+
)
|
35
|
+
headers = {}
|
36
|
+
headers['Accept'] = 'application/json'
|
37
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
38
|
+
|
39
|
+
r = @sdk_configuration.client.get(url) do |req|
|
40
|
+
req.headers = headers
|
41
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
42
|
+
end
|
43
|
+
|
44
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
45
|
+
|
46
|
+
res = Operations::GetSessionIdClipsResponse.new(
|
47
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
48
|
+
)
|
49
|
+
if r.status == 200
|
50
|
+
if Utils.match_content_type(content_type, 'application/json')
|
51
|
+
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::Asset])
|
52
|
+
res.classes = out
|
53
|
+
end
|
54
|
+
end
|
55
|
+
res
|
56
|
+
end
|
57
|
+
|
20
58
|
sig { returns(Utils::FieldAugmented) }
|
21
59
|
def get_all
|
22
60
|
# get_all - Retrieve sessions
|
@@ -40,7 +78,7 @@ module Livepeer
|
|
40
78
|
if r.status == 200
|
41
79
|
if Utils.match_content_type(content_type, 'application/json')
|
42
80
|
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::Session])
|
43
|
-
res.
|
81
|
+
res.classes = out
|
44
82
|
end
|
45
83
|
end
|
46
84
|
res
|
@@ -119,45 +157,7 @@ module Livepeer
|
|
119
157
|
if r.status == 200
|
120
158
|
if Utils.match_content_type(content_type, 'application/json')
|
121
159
|
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::Session])
|
122
|
-
res.
|
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
|
160
|
+
res.classes = out
|
161
161
|
end
|
162
162
|
end
|
163
163
|
res
|
@@ -9,7 +9,7 @@ require 'sorbet-runtime'
|
|
9
9
|
|
10
10
|
module Livepeer
|
11
11
|
extend T::Sig
|
12
|
-
class
|
12
|
+
class SigningKey
|
13
13
|
|
14
14
|
extend T::Sig
|
15
15
|
sig { params(sdk_config: SDKConfiguration).void }
|
@@ -18,37 +18,12 @@ module Livepeer
|
|
18
18
|
end
|
19
19
|
|
20
20
|
sig { returns(Utils::FieldAugmented) }
|
21
|
-
def
|
22
|
-
#
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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::GetSigningKeysResponse.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::SigningKey])
|
43
|
-
res.data = out
|
44
|
-
end
|
45
|
-
end
|
46
|
-
res
|
47
|
-
end
|
48
|
-
|
49
|
-
sig { returns(Utils::FieldAugmented) }
|
50
|
-
def create_signing_key
|
51
|
-
# create_signing_key - Create a signing key
|
21
|
+
def create
|
22
|
+
# create - Create a signing key
|
23
|
+
#
|
24
|
+
# The publicKey is a representation of the public key, encoded as base 64 and is passed as a string, and the privateKey is displayed only on creation. This is the only moment where the client can save the private key, otherwise it will be lost. Remember to decode your string when signing JWTs.
|
25
|
+
# Up to 10 signing keys can be generated, after that you must delete at least one signing key to create a new one.
|
26
|
+
#
|
52
27
|
url, params = @sdk_configuration.get_server_details
|
53
28
|
base_url = Utils.template_url(url, params)
|
54
29
|
url = "#{base_url}/access-control/signing-key"
|
@@ -68,16 +43,16 @@ module Livepeer
|
|
68
43
|
)
|
69
44
|
if r.status == 200
|
70
45
|
if Utils.match_content_type(content_type, 'application/json')
|
71
|
-
out = Utils.unmarshal_complex(r.env.response_body, Shared::
|
72
|
-
res.
|
46
|
+
out = Utils.unmarshal_complex(r.env.response_body, Shared::SigningKey)
|
47
|
+
res.signing_key = out
|
73
48
|
end
|
74
49
|
end
|
75
50
|
res
|
76
51
|
end
|
77
52
|
|
78
53
|
sig { params(key_id: String).returns(Utils::FieldAugmented) }
|
79
|
-
def
|
80
|
-
#
|
54
|
+
def delete(key_id)
|
55
|
+
# delete - Delete Signing Key
|
81
56
|
request = Operations::DeleteSigningKeyRequest.new(
|
82
57
|
|
83
58
|
key_id: key_id
|
@@ -110,8 +85,8 @@ module Livepeer
|
|
110
85
|
end
|
111
86
|
|
112
87
|
sig { params(key_id: String).returns(Utils::FieldAugmented) }
|
113
|
-
def
|
114
|
-
#
|
88
|
+
def get(key_id)
|
89
|
+
# get - Retrieves a signing key
|
115
90
|
request = Operations::GetSigningKeyRequest.new(
|
116
91
|
|
117
92
|
key_id: key_id
|
@@ -148,8 +123,8 @@ module Livepeer
|
|
148
123
|
end
|
149
124
|
|
150
125
|
sig { params(key_id: String, request_body: Operations::UpdateSigningKeyRequestBody).returns(Utils::FieldAugmented) }
|
151
|
-
def
|
152
|
-
#
|
126
|
+
def update(key_id, request_body)
|
127
|
+
# update - Update a signing key
|
153
128
|
request = Operations::UpdateSigningKeyRequest.new(
|
154
129
|
|
155
130
|
key_id: key_id,
|
data/lib/sdk/stream.rb
CHANGED
@@ -46,7 +46,7 @@ module Livepeer
|
|
46
46
|
if r.status == 200
|
47
47
|
if Utils.match_content_type(content_type, 'application/json')
|
48
48
|
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::Stream])
|
49
|
-
res.
|
49
|
+
res.classes = out
|
50
50
|
end
|
51
51
|
end
|
52
52
|
res
|
@@ -55,6 +55,20 @@ module Livepeer
|
|
55
55
|
sig { params(request: Shared::NewStreamPayload).returns(Utils::FieldAugmented) }
|
56
56
|
def create(request)
|
57
57
|
# create - Create a stream
|
58
|
+
# The only parameter you are required to set is the name of your stream,
|
59
|
+
# but we also highly recommend that you define transcoding profiles
|
60
|
+
# parameter that suits your specific broadcasting configuration.
|
61
|
+
# \
|
62
|
+
# \
|
63
|
+
# If you do not define transcoding rendition profiles when creating the
|
64
|
+
# stream, a default set of profiles will be used. These profiles include
|
65
|
+
# 240p, 360p, 480p and 720p.
|
66
|
+
# \
|
67
|
+
# \
|
68
|
+
# The playback policy is set to public by default for new streams. It can
|
69
|
+
# also be added upon the creation of a new stream by adding
|
70
|
+
# `"playbackPolicy": {"type": "jwt"}`
|
71
|
+
#
|
58
72
|
url, params = @sdk_configuration.get_server_details
|
59
73
|
base_url = Utils.template_url(url, params)
|
60
74
|
url = "#{base_url}/stream"
|
@@ -85,7 +99,7 @@ module Livepeer
|
|
85
99
|
if r.status == 200
|
86
100
|
if Utils.match_content_type(content_type, 'application/json')
|
87
101
|
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::Stream])
|
88
|
-
res.
|
102
|
+
res.classes = out
|
89
103
|
end
|
90
104
|
end
|
91
105
|
res
|
@@ -94,6 +108,12 @@ module Livepeer
|
|
94
108
|
sig { params(id: String).returns(Utils::FieldAugmented) }
|
95
109
|
def delete(id)
|
96
110
|
# delete - Delete a stream
|
111
|
+
#
|
112
|
+
# This will also suspend any active stream sessions, so make sure to wait
|
113
|
+
# until the stream has finished. To explicitly interrupt an active
|
114
|
+
# session, consider instead updating the suspended field in the stream
|
115
|
+
# using the PATCH stream API.
|
116
|
+
#
|
97
117
|
request = Operations::DeleteStreamRequest.new(
|
98
118
|
|
99
119
|
id: id
|
@@ -208,11 +228,52 @@ module Livepeer
|
|
208
228
|
res
|
209
229
|
end
|
210
230
|
|
231
|
+
sig { params(id: String).returns(Utils::FieldAugmented) }
|
232
|
+
def terminate(id)
|
233
|
+
# terminate - Terminates a live stream
|
234
|
+
# `DELETE /stream/{id}/terminate` can be used to terminate an ongoing
|
235
|
+
# session on a live stream. Unlike suspending the stream, it allows the
|
236
|
+
# streamer to restart streaming even immediately, but it will force
|
237
|
+
# terminate the current session and stop the recording.
|
238
|
+
# \
|
239
|
+
# \
|
240
|
+
# A 204 No Content status response indicates the stream was successfully
|
241
|
+
# terminated.
|
242
|
+
#
|
243
|
+
request = Operations::TerminateStreamRequest.new(
|
244
|
+
|
245
|
+
id: id
|
246
|
+
)
|
247
|
+
url, params = @sdk_configuration.get_server_details
|
248
|
+
base_url = Utils.template_url(url, params)
|
249
|
+
url = Utils.generate_url(
|
250
|
+
Operations::TerminateStreamRequest,
|
251
|
+
base_url,
|
252
|
+
'/stream/{id}/terminate',
|
253
|
+
request
|
254
|
+
)
|
255
|
+
headers = {}
|
256
|
+
headers['Accept'] = '*/*'
|
257
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
258
|
+
|
259
|
+
r = @sdk_configuration.client.delete(url) do |req|
|
260
|
+
req.headers = headers
|
261
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
262
|
+
end
|
263
|
+
|
264
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
265
|
+
|
266
|
+
res = Operations::TerminateStreamResponse.new(
|
267
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
268
|
+
)
|
269
|
+
if r.status == 204
|
270
|
+
end
|
271
|
+
res
|
272
|
+
end
|
273
|
+
|
211
274
|
sig { params(request: Shared::ClipPayload).returns(Utils::FieldAugmented) }
|
212
275
|
def create_clip(request)
|
213
276
|
# create_clip - Create a clip
|
214
|
-
# Create a clip from a livestream
|
215
|
-
#
|
216
277
|
url, params = @sdk_configuration.get_server_details
|
217
278
|
base_url = Utils.template_url(url, params)
|
218
279
|
url = "#{base_url}/clip"
|
@@ -242,8 +303,8 @@ module Livepeer
|
|
242
303
|
)
|
243
304
|
if r.status == 200
|
244
305
|
if Utils.match_content_type(content_type, 'application/json')
|
245
|
-
out = Utils.unmarshal_complex(r.env.response_body, Operations::
|
246
|
-
res.
|
306
|
+
out = Utils.unmarshal_complex(r.env.response_body, Operations::PostClipResponseBody)
|
307
|
+
res.object = out
|
247
308
|
end
|
248
309
|
end
|
249
310
|
res
|
@@ -281,9 +342,89 @@ module Livepeer
|
|
281
342
|
if r.status == 200
|
282
343
|
if Utils.match_content_type(content_type, 'application/json')
|
283
344
|
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::Asset])
|
284
|
-
res.
|
345
|
+
res.classes = out
|
346
|
+
end
|
347
|
+
end
|
348
|
+
res
|
349
|
+
end
|
350
|
+
|
351
|
+
sig { params(id: String, target_add_payload: Shared::TargetAddPayload).returns(Utils::FieldAugmented) }
|
352
|
+
def create_multistream_target(id, target_add_payload)
|
353
|
+
# create_multistream_target - Add a multistream target
|
354
|
+
request = Operations::AddMultistreamTargetRequest.new(
|
355
|
+
|
356
|
+
id: id,
|
357
|
+
target_add_payload: target_add_payload
|
358
|
+
)
|
359
|
+
url, params = @sdk_configuration.get_server_details
|
360
|
+
base_url = Utils.template_url(url, params)
|
361
|
+
url = Utils.generate_url(
|
362
|
+
Operations::AddMultistreamTargetRequest,
|
363
|
+
base_url,
|
364
|
+
'/stream/{id}/create-multistream-target',
|
365
|
+
request
|
366
|
+
)
|
367
|
+
headers = {}
|
368
|
+
req_content_type, data, form = Utils.serialize_request_body(request, :target_add_payload, :json)
|
369
|
+
headers['content-type'] = req_content_type
|
370
|
+
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
371
|
+
headers['Accept'] = '*/*'
|
372
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
373
|
+
|
374
|
+
r = @sdk_configuration.client.post(url) do |req|
|
375
|
+
req.headers = headers
|
376
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
377
|
+
if form
|
378
|
+
req.body = Utils.encode_form(form)
|
379
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
380
|
+
req.body = URI.encode_www_form(data)
|
381
|
+
else
|
382
|
+
req.body = data
|
285
383
|
end
|
286
384
|
end
|
385
|
+
|
386
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
387
|
+
|
388
|
+
res = Operations::AddMultistreamTargetResponse.new(
|
389
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
390
|
+
)
|
391
|
+
if r.status == 204
|
392
|
+
end
|
393
|
+
res
|
394
|
+
end
|
395
|
+
|
396
|
+
sig { params(id: String, target_id: String).returns(Utils::FieldAugmented) }
|
397
|
+
def delete_multistream_target(id, target_id)
|
398
|
+
# delete_multistream_target - Remove a multistream target
|
399
|
+
request = Operations::RemoveMultistreamTargetRequest.new(
|
400
|
+
|
401
|
+
id: id,
|
402
|
+
target_id: target_id
|
403
|
+
)
|
404
|
+
url, params = @sdk_configuration.get_server_details
|
405
|
+
base_url = Utils.template_url(url, params)
|
406
|
+
url = Utils.generate_url(
|
407
|
+
Operations::RemoveMultistreamTargetRequest,
|
408
|
+
base_url,
|
409
|
+
'/stream/{id}/multistream/{targetId}',
|
410
|
+
request
|
411
|
+
)
|
412
|
+
headers = {}
|
413
|
+
headers['Accept'] = '*/*'
|
414
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
415
|
+
|
416
|
+
r = @sdk_configuration.client.delete(url) do |req|
|
417
|
+
req.headers = headers
|
418
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
419
|
+
end
|
420
|
+
|
421
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
422
|
+
|
423
|
+
res = Operations::RemoveMultistreamTargetResponse.new(
|
424
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
425
|
+
)
|
426
|
+
if r.status == 204
|
427
|
+
end
|
287
428
|
res
|
288
429
|
end
|
289
430
|
end
|
data/lib/sdk/task.rb
CHANGED
data/lib/sdk/transcode.rb
CHANGED
@@ -17,9 +17,131 @@ module Livepeer
|
|
17
17
|
@sdk_configuration = sdk_config
|
18
18
|
end
|
19
19
|
|
20
|
-
sig { params(request: Shared::
|
20
|
+
sig { params(request: Shared::TranscodePayload).returns(Utils::FieldAugmented) }
|
21
21
|
def create(request)
|
22
22
|
# create - Transcode a video
|
23
|
+
# `POST /transcode` transcodes a video file and uploads the results to the
|
24
|
+
# specified storage service.
|
25
|
+
# \
|
26
|
+
# \
|
27
|
+
# Transcoding is asynchronous so you will need to check the status of the
|
28
|
+
# task in order to determine when transcoding is complete. The `id` field
|
29
|
+
# in the response is the unique ID for the transcoding `Task`. The task
|
30
|
+
# status can be queried using the [GET tasks
|
31
|
+
# endpoint](https://docs.livepeer.org/reference/api/get-tasks):
|
32
|
+
# \
|
33
|
+
# \
|
34
|
+
# When `status.phase` is `completed`, transcoding will be complete and
|
35
|
+
# the results will be stored in the storage service and the specified
|
36
|
+
# output location.
|
37
|
+
# \
|
38
|
+
# \
|
39
|
+
# The results will be available under `params.outputs.hls.path` and
|
40
|
+
# `params.outputs.mp4.path` in the specified storage service.
|
41
|
+
# ## Input
|
42
|
+
# \
|
43
|
+
# This endpoint currently supports the following inputs:
|
44
|
+
# - HTTP
|
45
|
+
# - S3 API Compatible Service
|
46
|
+
# \
|
47
|
+
# \
|
48
|
+
# **HTTP**
|
49
|
+
# \
|
50
|
+
# A public HTTP URL can be used to read a video file.
|
51
|
+
# ```json
|
52
|
+
# {
|
53
|
+
# "url": "https://www.example.com/video.mp4"
|
54
|
+
# }
|
55
|
+
# ```
|
56
|
+
# | Name | Type | Description |
|
57
|
+
# | ---- | ------ | ------------------------------------ |
|
58
|
+
# | url | string | A public HTTP URL for the video file. |
|
59
|
+
#
|
60
|
+
# Note: For IPFS HTTP gateway URLs, the API currently only supports “path
|
61
|
+
# style” URLs and does not support “subdomain style” URLs. The API will
|
62
|
+
# support both styles of URLs in a future update.
|
63
|
+
# \
|
64
|
+
# \
|
65
|
+
# **S3 API Compatible Service**
|
66
|
+
# \
|
67
|
+
# \
|
68
|
+
# S3 credentials can be used to authenticate with a S3 API compatible
|
69
|
+
# service to read a video file.
|
70
|
+
#
|
71
|
+
# ```json
|
72
|
+
# {
|
73
|
+
# "type": "s3",
|
74
|
+
# "endpoint": "https://gateway.storjshare.io",
|
75
|
+
# "credentials": {
|
76
|
+
# "accessKeyId": "$ACCESS_KEY_ID",
|
77
|
+
# "secretAccessKey": "$SECRET_ACCESS_KEY"
|
78
|
+
# },
|
79
|
+
# "bucket": "inbucket",
|
80
|
+
# "path": "/video/source.mp4"
|
81
|
+
# }
|
82
|
+
# ```
|
83
|
+
#
|
84
|
+
#
|
85
|
+
# ## Storage
|
86
|
+
# \
|
87
|
+
# This endpoint currently supports the following storage services:
|
88
|
+
# - S3 API Compatible Service
|
89
|
+
# - Web3 Storage
|
90
|
+
# \
|
91
|
+
# \
|
92
|
+
# **S3 API Compatible Service**
|
93
|
+
# ```json
|
94
|
+
# {
|
95
|
+
# "type": "s3",
|
96
|
+
# "endpoint": "https://gateway.storjshare.io",
|
97
|
+
# "credentials": {
|
98
|
+
# "accessKeyId": "$ACCESS_KEY_ID",
|
99
|
+
# "secretAccessKey": "$SECRET_ACCESS_KEY"
|
100
|
+
# },
|
101
|
+
# "bucket": "mybucket"
|
102
|
+
# }
|
103
|
+
# ```
|
104
|
+
#
|
105
|
+
# **Web3 Storage**
|
106
|
+
#
|
107
|
+
# ```json
|
108
|
+
# {
|
109
|
+
# "type": "web3.storage",
|
110
|
+
# "credentials": {
|
111
|
+
# "proof": "$UCAN_DELEGATION_PROOF",
|
112
|
+
# }
|
113
|
+
# }
|
114
|
+
# ```
|
115
|
+
#
|
116
|
+
#
|
117
|
+
#
|
118
|
+
# ## Outputs
|
119
|
+
# \
|
120
|
+
# This endpoint currently supports the following output types:
|
121
|
+
# - HLS
|
122
|
+
# - MP4
|
123
|
+
#
|
124
|
+
# **HLS**
|
125
|
+
#
|
126
|
+
# ```json
|
127
|
+
# {
|
128
|
+
# "hls": {
|
129
|
+
# "path": "/samplevideo/hls"
|
130
|
+
# }
|
131
|
+
# }
|
132
|
+
# ```
|
133
|
+
#
|
134
|
+
#
|
135
|
+
# **MP4**
|
136
|
+
#
|
137
|
+
# ```json
|
138
|
+
# {
|
139
|
+
# "mp4": {
|
140
|
+
# "path": "/samplevideo/mp4"
|
141
|
+
# }
|
142
|
+
# }
|
143
|
+
# ```
|
144
|
+
#
|
23
145
|
url, params = @sdk_configuration.get_server_details
|
24
146
|
base_url = Utils.template_url(url, params)
|
25
147
|
url = "#{base_url}/transcode"
|
data/lib/sdk/webhook.rb
CHANGED
@@ -40,7 +40,7 @@ module Livepeer
|
|
40
40
|
if r.status == 200
|
41
41
|
if Utils.match_content_type(content_type, 'application/json')
|
42
42
|
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::Webhook])
|
43
|
-
res.
|
43
|
+
res.classes = out
|
44
44
|
end
|
45
45
|
end
|
46
46
|
res
|
@@ -49,6 +49,8 @@ module Livepeer
|
|
49
49
|
sig { returns(Utils::FieldAugmented) }
|
50
50
|
def create
|
51
51
|
# create - Create a webhook
|
52
|
+
# To create a new webhook, you need to make an API call with the events you want to listen for and the URL that will be called when those events occur.
|
53
|
+
#
|
52
54
|
url, params = @sdk_configuration.get_server_details
|
53
55
|
base_url = Utils.template_url(url, params)
|
54
56
|
url = "#{base_url}/webhook"
|