appwrite 30.4.0 → 30.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/appwrite/client.rb +1 -1
- data/lib/appwrite/enums/alert_comparator.rb +10 -0
- data/lib/appwrite/enums/alert_metric.rb +36 -0
- data/lib/appwrite/enums/alert_status.rb +8 -0
- data/lib/appwrite/enums/monitor_method.rb +13 -0
- data/lib/appwrite/enums/monitor_record.rb +12 -0
- data/lib/appwrite/enums/monitor_resource_type.rb +13 -0
- data/lib/appwrite/enums/monitor_result.rb +19 -0
- data/lib/appwrite/enums/monitor_severity.rb +10 -0
- data/lib/appwrite/enums/monitor_status.rb +8 -0
- data/lib/appwrite/enums/monitor_tls_mode.rb +10 -0
- data/lib/appwrite/enums/monitor_type.rb +12 -0
- data/lib/appwrite/enums/video_caption_status.rb +11 -0
- data/lib/appwrite/enums/video_codec_id.rb +9 -0
- data/lib/appwrite/enums/video_output.rb +9 -0
- data/lib/appwrite/enums/video_rendition_status.rb +12 -0
- data/lib/appwrite/enums/video_timeline_status.rb +11 -0
- data/lib/appwrite/models/alert.rb +308 -0
- data/lib/appwrite/models/alert_list.rb +33 -0
- data/lib/appwrite/models/escalation.rb +53 -0
- data/lib/appwrite/models/escalation_list.rb +33 -0
- data/lib/appwrite/models/escalation_step.rb +38 -0
- data/lib/appwrite/models/monitor.rb +342 -0
- data/lib/appwrite/models/monitor_list.rb +33 -0
- data/lib/appwrite/models/video.rb +166 -0
- data/lib/appwrite/models/video_caption.rb +111 -0
- data/lib/appwrite/models/video_caption_list.rb +33 -0
- data/lib/appwrite/models/video_codec.rb +56 -0
- data/lib/appwrite/models/video_codec_list.rb +33 -0
- data/lib/appwrite/models/video_list.rb +33 -0
- data/lib/appwrite/models/video_profile.rb +84 -0
- data/lib/appwrite/models/video_profile_list.rb +33 -0
- data/lib/appwrite/models/video_rendition.rb +165 -0
- data/lib/appwrite/models/video_rendition_list.rb +33 -0
- data/lib/appwrite/services/alerts.rb +118 -0
- data/lib/appwrite/services/monitors.rb +862 -0
- data/lib/appwrite/services/organization.rb +197 -0
- data/lib/appwrite/services/project.rb +233 -0
- data/lib/appwrite/services/videos.rb +966 -0
- data/lib/appwrite.rb +36 -0
- metadata +38 -2
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class VideoCaption
|
|
6
|
+
attr_reader :id
|
|
7
|
+
attr_reader :created_at
|
|
8
|
+
attr_reader :updated_at
|
|
9
|
+
attr_reader :video_id
|
|
10
|
+
attr_reader :bucket_id
|
|
11
|
+
attr_reader :file_id
|
|
12
|
+
attr_reader :name
|
|
13
|
+
attr_reader :language
|
|
14
|
+
attr_reader :default
|
|
15
|
+
attr_reader :embedded
|
|
16
|
+
attr_reader :target_duration
|
|
17
|
+
attr_reader :status
|
|
18
|
+
attr_reader :error
|
|
19
|
+
attr_reader :size
|
|
20
|
+
|
|
21
|
+
def initialize(
|
|
22
|
+
id:,
|
|
23
|
+
created_at:,
|
|
24
|
+
updated_at:,
|
|
25
|
+
video_id:,
|
|
26
|
+
bucket_id:,
|
|
27
|
+
file_id:,
|
|
28
|
+
name:,
|
|
29
|
+
language:,
|
|
30
|
+
default:,
|
|
31
|
+
embedded:,
|
|
32
|
+
target_duration:,
|
|
33
|
+
status:,
|
|
34
|
+
error:,
|
|
35
|
+
size:
|
|
36
|
+
)
|
|
37
|
+
@id = id
|
|
38
|
+
@created_at = created_at
|
|
39
|
+
@updated_at = updated_at
|
|
40
|
+
@video_id = video_id
|
|
41
|
+
@bucket_id = bucket_id
|
|
42
|
+
@file_id = file_id
|
|
43
|
+
@name = name
|
|
44
|
+
@language = language
|
|
45
|
+
@default = default
|
|
46
|
+
@embedded = embedded
|
|
47
|
+
@target_duration = target_duration
|
|
48
|
+
@status = validate_status(status)
|
|
49
|
+
@error = error
|
|
50
|
+
@size = size
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def self.from(map:)
|
|
54
|
+
map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "videoId" => "", "bucketId" => "", "fileId" => "", "name" => "", "language" => "", "default" => false, "embedded" => false, "targetDuration" => 0, "status" => "pending", "error" => "", "size" => 0 }.merge(map)
|
|
55
|
+
VideoCaption.new(
|
|
56
|
+
id: map["$id"],
|
|
57
|
+
created_at: map["$createdAt"],
|
|
58
|
+
updated_at: map["$updatedAt"],
|
|
59
|
+
video_id: map["videoId"],
|
|
60
|
+
bucket_id: map["bucketId"],
|
|
61
|
+
file_id: map["fileId"],
|
|
62
|
+
name: map["name"],
|
|
63
|
+
language: map["language"],
|
|
64
|
+
default: map["default"],
|
|
65
|
+
embedded: map["embedded"],
|
|
66
|
+
target_duration: map["targetDuration"],
|
|
67
|
+
status: map["status"],
|
|
68
|
+
error: map["error"],
|
|
69
|
+
size: map["size"]
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def to_map
|
|
74
|
+
{
|
|
75
|
+
"$id": @id,
|
|
76
|
+
"$createdAt": @created_at,
|
|
77
|
+
"$updatedAt": @updated_at,
|
|
78
|
+
"videoId": @video_id,
|
|
79
|
+
"bucketId": @bucket_id,
|
|
80
|
+
"fileId": @file_id,
|
|
81
|
+
"name": @name,
|
|
82
|
+
"language": @language,
|
|
83
|
+
"default": @default,
|
|
84
|
+
"embedded": @embedded,
|
|
85
|
+
"targetDuration": @target_duration,
|
|
86
|
+
"status": @status,
|
|
87
|
+
"error": @error,
|
|
88
|
+
"size": @size
|
|
89
|
+
}
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
private
|
|
93
|
+
|
|
94
|
+
def validate_status(status)
|
|
95
|
+
valid_status = [
|
|
96
|
+
Appwrite::Enums::VideoCaptionStatus::PENDING,
|
|
97
|
+
Appwrite::Enums::VideoCaptionStatus::STARTED,
|
|
98
|
+
Appwrite::Enums::VideoCaptionStatus::READY,
|
|
99
|
+
Appwrite::Enums::VideoCaptionStatus::ERROR,
|
|
100
|
+
Appwrite::Enums::VideoCaptionStatus::ABORTED,
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
unless valid_status.include?(status)
|
|
104
|
+
raise ArgumentError, "Invalid " + status + ". Must be one of: " + valid_status.join(', ')
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
status
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class VideoCaptionList
|
|
6
|
+
attr_reader :total
|
|
7
|
+
attr_reader :captions
|
|
8
|
+
|
|
9
|
+
def initialize(
|
|
10
|
+
total:,
|
|
11
|
+
captions:
|
|
12
|
+
)
|
|
13
|
+
@total = total
|
|
14
|
+
@captions = captions
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.from(map:)
|
|
18
|
+
map = { "total" => 0, "captions" => [] }.merge(map)
|
|
19
|
+
VideoCaptionList.new(
|
|
20
|
+
total: map["total"],
|
|
21
|
+
captions: map["captions"].map { |it| VideoCaption.from(map: it) }
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def to_map
|
|
26
|
+
{
|
|
27
|
+
"total": @total,
|
|
28
|
+
"captions": @captions.map { |it| it.to_map }
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class VideoCodec
|
|
6
|
+
attr_reader :id
|
|
7
|
+
attr_reader :name
|
|
8
|
+
attr_reader :outputs
|
|
9
|
+
|
|
10
|
+
def initialize(
|
|
11
|
+
id:,
|
|
12
|
+
name:,
|
|
13
|
+
outputs:
|
|
14
|
+
)
|
|
15
|
+
@id = id
|
|
16
|
+
@name = name
|
|
17
|
+
@outputs = validate_outputs(outputs)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.from(map:)
|
|
21
|
+
map = { "$id" => "", "name" => "", "outputs" => [] }.merge(map)
|
|
22
|
+
VideoCodec.new(
|
|
23
|
+
id: map["$id"],
|
|
24
|
+
name: map["name"],
|
|
25
|
+
outputs: map["outputs"]
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def to_map
|
|
30
|
+
{
|
|
31
|
+
"$id": @id,
|
|
32
|
+
"name": @name,
|
|
33
|
+
"outputs": @outputs
|
|
34
|
+
}
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def validate_outputs(outputs)
|
|
40
|
+
valid_outputs = [
|
|
41
|
+
Appwrite::Enums::VideoOutput::HLS,
|
|
42
|
+
Appwrite::Enums::VideoOutput::DASH,
|
|
43
|
+
Appwrite::Enums::VideoOutput::CMAF,
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
(outputs || []).each do |value|
|
|
47
|
+
unless valid_outputs.include?(value)
|
|
48
|
+
raise ArgumentError, "Invalid " + value.to_s + ". Must be one of: " + valid_outputs.join(', ')
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
outputs
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class VideoCodecList
|
|
6
|
+
attr_reader :total
|
|
7
|
+
attr_reader :codecs
|
|
8
|
+
|
|
9
|
+
def initialize(
|
|
10
|
+
total:,
|
|
11
|
+
codecs:
|
|
12
|
+
)
|
|
13
|
+
@total = total
|
|
14
|
+
@codecs = codecs
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.from(map:)
|
|
18
|
+
map = { "total" => 0, "codecs" => [] }.merge(map)
|
|
19
|
+
VideoCodecList.new(
|
|
20
|
+
total: map["total"],
|
|
21
|
+
codecs: map["codecs"].map { |it| VideoCodec.from(map: it) }
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def to_map
|
|
26
|
+
{
|
|
27
|
+
"total": @total,
|
|
28
|
+
"codecs": @codecs.map { |it| it.to_map }
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class VideoList
|
|
6
|
+
attr_reader :total
|
|
7
|
+
attr_reader :videos
|
|
8
|
+
|
|
9
|
+
def initialize(
|
|
10
|
+
total:,
|
|
11
|
+
videos:
|
|
12
|
+
)
|
|
13
|
+
@total = total
|
|
14
|
+
@videos = videos
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.from(map:)
|
|
18
|
+
map = { "total" => 0, "videos" => [] }.merge(map)
|
|
19
|
+
VideoList.new(
|
|
20
|
+
total: map["total"],
|
|
21
|
+
videos: map["videos"].map { |it| Video.from(map: it) }
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def to_map
|
|
26
|
+
{
|
|
27
|
+
"total": @total,
|
|
28
|
+
"videos": @videos.map { |it| it.to_map }
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class VideoProfile
|
|
6
|
+
attr_reader :id
|
|
7
|
+
attr_reader :created_at
|
|
8
|
+
attr_reader :updated_at
|
|
9
|
+
attr_reader :name
|
|
10
|
+
attr_reader :codec
|
|
11
|
+
attr_reader :video_bit_rate
|
|
12
|
+
attr_reader :audio_bit_rate
|
|
13
|
+
attr_reader :width
|
|
14
|
+
attr_reader :height
|
|
15
|
+
|
|
16
|
+
def initialize(
|
|
17
|
+
id:,
|
|
18
|
+
created_at:,
|
|
19
|
+
updated_at:,
|
|
20
|
+
name:,
|
|
21
|
+
codec:,
|
|
22
|
+
video_bit_rate:,
|
|
23
|
+
audio_bit_rate:,
|
|
24
|
+
width:,
|
|
25
|
+
height:
|
|
26
|
+
)
|
|
27
|
+
@id = id
|
|
28
|
+
@created_at = created_at
|
|
29
|
+
@updated_at = updated_at
|
|
30
|
+
@name = name
|
|
31
|
+
@codec = validate_codec(codec)
|
|
32
|
+
@video_bit_rate = video_bit_rate
|
|
33
|
+
@audio_bit_rate = audio_bit_rate
|
|
34
|
+
@width = width
|
|
35
|
+
@height = height
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.from(map:)
|
|
39
|
+
map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "name" => "", "codec" => "h264", "videoBitRate" => 0, "audioBitRate" => 0, "width" => 0, "height" => 0 }.merge(map)
|
|
40
|
+
VideoProfile.new(
|
|
41
|
+
id: map["$id"],
|
|
42
|
+
created_at: map["$createdAt"],
|
|
43
|
+
updated_at: map["$updatedAt"],
|
|
44
|
+
name: map["name"],
|
|
45
|
+
codec: map["codec"],
|
|
46
|
+
video_bit_rate: map["videoBitRate"],
|
|
47
|
+
audio_bit_rate: map["audioBitRate"],
|
|
48
|
+
width: map["width"],
|
|
49
|
+
height: map["height"]
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def to_map
|
|
54
|
+
{
|
|
55
|
+
"$id": @id,
|
|
56
|
+
"$createdAt": @created_at,
|
|
57
|
+
"$updatedAt": @updated_at,
|
|
58
|
+
"name": @name,
|
|
59
|
+
"codec": @codec,
|
|
60
|
+
"videoBitRate": @video_bit_rate,
|
|
61
|
+
"audioBitRate": @audio_bit_rate,
|
|
62
|
+
"width": @width,
|
|
63
|
+
"height": @height
|
|
64
|
+
}
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
private
|
|
68
|
+
|
|
69
|
+
def validate_codec(codec)
|
|
70
|
+
valid_codec = [
|
|
71
|
+
Appwrite::Enums::VideoCodecId::H264,
|
|
72
|
+
Appwrite::Enums::VideoCodecId::HEVC,
|
|
73
|
+
Appwrite::Enums::VideoCodecId::VP9,
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
unless valid_codec.include?(codec)
|
|
77
|
+
raise ArgumentError, "Invalid " + codec + ". Must be one of: " + valid_codec.join(', ')
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
codec
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class VideoProfileList
|
|
6
|
+
attr_reader :total
|
|
7
|
+
attr_reader :profiles
|
|
8
|
+
|
|
9
|
+
def initialize(
|
|
10
|
+
total:,
|
|
11
|
+
profiles:
|
|
12
|
+
)
|
|
13
|
+
@total = total
|
|
14
|
+
@profiles = profiles
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.from(map:)
|
|
18
|
+
map = { "total" => 0, "profiles" => [] }.merge(map)
|
|
19
|
+
VideoProfileList.new(
|
|
20
|
+
total: map["total"],
|
|
21
|
+
profiles: map["profiles"].map { |it| VideoProfile.from(map: it) }
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def to_map
|
|
26
|
+
{
|
|
27
|
+
"total": @total,
|
|
28
|
+
"profiles": @profiles.map { |it| it.to_map }
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class VideoRendition
|
|
6
|
+
attr_reader :id
|
|
7
|
+
attr_reader :created_at
|
|
8
|
+
attr_reader :updated_at
|
|
9
|
+
attr_reader :video_id
|
|
10
|
+
attr_reader :profile_id
|
|
11
|
+
attr_reader :name
|
|
12
|
+
attr_reader :started_at
|
|
13
|
+
attr_reader :ended_at
|
|
14
|
+
attr_reader :width
|
|
15
|
+
attr_reader :height
|
|
16
|
+
attr_reader :video_bit_rate
|
|
17
|
+
attr_reader :audio_bit_rate
|
|
18
|
+
attr_reader :target_duration
|
|
19
|
+
attr_reader :status
|
|
20
|
+
attr_reader :error
|
|
21
|
+
attr_reader :progress
|
|
22
|
+
attr_reader :output
|
|
23
|
+
attr_reader :codec
|
|
24
|
+
attr_reader :size
|
|
25
|
+
|
|
26
|
+
def initialize(
|
|
27
|
+
id:,
|
|
28
|
+
created_at:,
|
|
29
|
+
updated_at:,
|
|
30
|
+
video_id:,
|
|
31
|
+
profile_id:,
|
|
32
|
+
name:,
|
|
33
|
+
started_at:,
|
|
34
|
+
ended_at:,
|
|
35
|
+
width:,
|
|
36
|
+
height:,
|
|
37
|
+
video_bit_rate:,
|
|
38
|
+
audio_bit_rate:,
|
|
39
|
+
target_duration:,
|
|
40
|
+
status:,
|
|
41
|
+
error:,
|
|
42
|
+
progress:,
|
|
43
|
+
output:,
|
|
44
|
+
codec:,
|
|
45
|
+
size:
|
|
46
|
+
)
|
|
47
|
+
@id = id
|
|
48
|
+
@created_at = created_at
|
|
49
|
+
@updated_at = updated_at
|
|
50
|
+
@video_id = video_id
|
|
51
|
+
@profile_id = profile_id
|
|
52
|
+
@name = name
|
|
53
|
+
@started_at = started_at
|
|
54
|
+
@ended_at = ended_at
|
|
55
|
+
@width = width
|
|
56
|
+
@height = height
|
|
57
|
+
@video_bit_rate = video_bit_rate
|
|
58
|
+
@audio_bit_rate = audio_bit_rate
|
|
59
|
+
@target_duration = target_duration
|
|
60
|
+
@status = validate_status(status)
|
|
61
|
+
@error = error
|
|
62
|
+
@progress = progress
|
|
63
|
+
@output = validate_output(output)
|
|
64
|
+
@codec = validate_codec(codec)
|
|
65
|
+
@size = size
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def self.from(map:)
|
|
69
|
+
map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "videoId" => "", "profileId" => "", "name" => "", "startedAt" => "", "endedAt" => "", "width" => 0, "height" => 0, "videoBitRate" => 0, "audioBitRate" => 0, "targetDuration" => 0, "status" => "pending", "error" => "", "progress" => 0, "output" => "hls", "codec" => "h264", "size" => 0 }.merge(map)
|
|
70
|
+
VideoRendition.new(
|
|
71
|
+
id: map["$id"],
|
|
72
|
+
created_at: map["$createdAt"],
|
|
73
|
+
updated_at: map["$updatedAt"],
|
|
74
|
+
video_id: map["videoId"],
|
|
75
|
+
profile_id: map["profileId"],
|
|
76
|
+
name: map["name"],
|
|
77
|
+
started_at: map["startedAt"],
|
|
78
|
+
ended_at: map["endedAt"],
|
|
79
|
+
width: map["width"],
|
|
80
|
+
height: map["height"],
|
|
81
|
+
video_bit_rate: map["videoBitRate"],
|
|
82
|
+
audio_bit_rate: map["audioBitRate"],
|
|
83
|
+
target_duration: map["targetDuration"],
|
|
84
|
+
status: map["status"],
|
|
85
|
+
error: map["error"],
|
|
86
|
+
progress: map["progress"],
|
|
87
|
+
output: map["output"],
|
|
88
|
+
codec: map["codec"],
|
|
89
|
+
size: map["size"]
|
|
90
|
+
)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def to_map
|
|
94
|
+
{
|
|
95
|
+
"$id": @id,
|
|
96
|
+
"$createdAt": @created_at,
|
|
97
|
+
"$updatedAt": @updated_at,
|
|
98
|
+
"videoId": @video_id,
|
|
99
|
+
"profileId": @profile_id,
|
|
100
|
+
"name": @name,
|
|
101
|
+
"startedAt": @started_at,
|
|
102
|
+
"endedAt": @ended_at,
|
|
103
|
+
"width": @width,
|
|
104
|
+
"height": @height,
|
|
105
|
+
"videoBitRate": @video_bit_rate,
|
|
106
|
+
"audioBitRate": @audio_bit_rate,
|
|
107
|
+
"targetDuration": @target_duration,
|
|
108
|
+
"status": @status,
|
|
109
|
+
"error": @error,
|
|
110
|
+
"progress": @progress,
|
|
111
|
+
"output": @output,
|
|
112
|
+
"codec": @codec,
|
|
113
|
+
"size": @size
|
|
114
|
+
}
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
private
|
|
118
|
+
|
|
119
|
+
def validate_status(status)
|
|
120
|
+
valid_status = [
|
|
121
|
+
Appwrite::Enums::VideoRenditionStatus::PENDING,
|
|
122
|
+
Appwrite::Enums::VideoRenditionStatus::STARTED,
|
|
123
|
+
Appwrite::Enums::VideoRenditionStatus::ENDED,
|
|
124
|
+
Appwrite::Enums::VideoRenditionStatus::READY,
|
|
125
|
+
Appwrite::Enums::VideoRenditionStatus::ERROR,
|
|
126
|
+
Appwrite::Enums::VideoRenditionStatus::ABORTED,
|
|
127
|
+
]
|
|
128
|
+
|
|
129
|
+
unless valid_status.include?(status)
|
|
130
|
+
raise ArgumentError, "Invalid " + status + ". Must be one of: " + valid_status.join(', ')
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
status
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def validate_output(output)
|
|
137
|
+
valid_output = [
|
|
138
|
+
Appwrite::Enums::VideoOutput::HLS,
|
|
139
|
+
Appwrite::Enums::VideoOutput::DASH,
|
|
140
|
+
Appwrite::Enums::VideoOutput::CMAF,
|
|
141
|
+
]
|
|
142
|
+
|
|
143
|
+
unless valid_output.include?(output)
|
|
144
|
+
raise ArgumentError, "Invalid " + output + ". Must be one of: " + valid_output.join(', ')
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
output
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def validate_codec(codec)
|
|
151
|
+
valid_codec = [
|
|
152
|
+
Appwrite::Enums::VideoCodecId::H264,
|
|
153
|
+
Appwrite::Enums::VideoCodecId::HEVC,
|
|
154
|
+
Appwrite::Enums::VideoCodecId::VP9,
|
|
155
|
+
]
|
|
156
|
+
|
|
157
|
+
unless valid_codec.include?(codec)
|
|
158
|
+
raise ArgumentError, "Invalid " + codec + ". Must be one of: " + valid_codec.join(', ')
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
codec
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class VideoRenditionList
|
|
6
|
+
attr_reader :total
|
|
7
|
+
attr_reader :renditions
|
|
8
|
+
|
|
9
|
+
def initialize(
|
|
10
|
+
total:,
|
|
11
|
+
renditions:
|
|
12
|
+
)
|
|
13
|
+
@total = total
|
|
14
|
+
@renditions = renditions
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.from(map:)
|
|
18
|
+
map = { "total" => 0, "renditions" => [] }.merge(map)
|
|
19
|
+
VideoRenditionList.new(
|
|
20
|
+
total: map["total"],
|
|
21
|
+
renditions: map["renditions"].map { |it| VideoRendition.from(map: it) }
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def to_map
|
|
26
|
+
{
|
|
27
|
+
"total": @total,
|
|
28
|
+
"renditions": @renditions.map { |it| it.to_map }
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|