assemblyai 1.0.0.pre.beta.6 → 1.0.0.pre.beta.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assemblyai/files/client.rb +4 -2
- data/lib/assemblyai/files/types/uploaded_file.rb +20 -11
- data/lib/assemblyai/lemur/client.rb +256 -150
- data/lib/assemblyai/lemur/types/lemur_action_items_response.rb +28 -14
- data/lib/assemblyai/lemur/types/lemur_base_params.rb +83 -54
- data/lib/assemblyai/lemur/types/lemur_base_params_context.rb +11 -5
- data/lib/assemblyai/lemur/types/lemur_base_response.rb +20 -11
- data/lib/assemblyai/lemur/types/lemur_question.rb +57 -31
- data/lib/assemblyai/lemur/types/lemur_question_answer.rb +28 -14
- data/lib/assemblyai/lemur/types/lemur_question_answer_response.rb +29 -14
- data/lib/assemblyai/lemur/types/lemur_question_context.rb +13 -6
- data/lib/assemblyai/lemur/types/lemur_summary_response.rb +28 -14
- data/lib/assemblyai/lemur/types/lemur_task_response.rb +28 -14
- data/lib/assemblyai/lemur/types/purge_lemur_request_data_response.rb +32 -17
- data/lib/assemblyai/realtime/client.rb +32 -16
- data/lib/assemblyai/realtime/types/configure_end_utterance_silence_threshold.rb +24 -13
- data/lib/assemblyai/realtime/types/final_transcript.rb +72 -41
- data/lib/assemblyai/realtime/types/force_end_utterance.rb +20 -11
- data/lib/assemblyai/realtime/types/message_type.rb +1 -0
- data/lib/assemblyai/realtime/types/partial_transcript.rb +62 -34
- data/lib/assemblyai/realtime/types/realtime_base_message.rb +22 -13
- data/lib/assemblyai/realtime/types/realtime_base_transcript.rb +57 -31
- data/lib/assemblyai/realtime/types/realtime_error.rb +20 -11
- data/lib/assemblyai/realtime/types/realtime_message.rb +44 -18
- data/lib/assemblyai/realtime/types/realtime_temporary_token_response.rb +21 -12
- data/lib/assemblyai/realtime/types/realtime_transcript.rb +15 -9
- data/lib/assemblyai/realtime/types/session_begins.rb +31 -14
- data/lib/assemblyai/realtime/types/session_information.rb +69 -0
- data/lib/assemblyai/realtime/types/session_terminated.rb +20 -11
- data/lib/assemblyai/realtime/types/terminate_session.rb +21 -12
- data/lib/assemblyai/realtime/types/word.rb +36 -18
- data/lib/assemblyai/streaming/types/receive_message.rb +113 -0
- data/lib/assemblyai/streaming/types/send_message.rb +86 -0
- data/lib/assemblyai/streaming/types/streaming.rb +11 -0
- data/lib/assemblyai/transcripts/client.rb +54 -20
- data/lib/assemblyai/transcripts/list_by_url_client.rb +6 -4
- data/lib/assemblyai/transcripts/polling_client.rb +12 -2
- data/lib/assemblyai/transcripts/types/auto_highlight_result.rb +40 -19
- data/lib/assemblyai/transcripts/types/auto_highlights_result.rb +38 -14
- data/lib/assemblyai/transcripts/types/chapter.rb +40 -20
- data/lib/assemblyai/transcripts/types/content_safety_label.rb +32 -16
- data/lib/assemblyai/transcripts/types/content_safety_label_result.rb +51 -29
- data/lib/assemblyai/transcripts/types/content_safety_labels_result.rb +51 -29
- data/lib/assemblyai/transcripts/types/entity.rb +41 -21
- data/lib/assemblyai/transcripts/types/page_details.rb +60 -33
- data/lib/assemblyai/transcripts/types/paragraphs_response.rb +37 -19
- data/lib/assemblyai/transcripts/types/redact_pii_audio_quality.rb +4 -1
- data/lib/assemblyai/transcripts/types/redacted_audio_response.rb +29 -15
- data/lib/assemblyai/transcripts/types/sentences_response.rb +37 -19
- data/lib/assemblyai/transcripts/types/sentiment_analysis_result.rb +62 -35
- data/lib/assemblyai/transcripts/types/severity_score_summary.rb +32 -16
- data/lib/assemblyai/transcripts/types/speech_model.rb +2 -0
- data/lib/assemblyai/transcripts/types/substitution_policy.rb +4 -2
- data/lib/assemblyai/transcripts/types/timestamp.rb +28 -14
- data/lib/assemblyai/transcripts/types/topic_detection_model_result.rb +39 -19
- data/lib/assemblyai/transcripts/types/topic_detection_result.rb +40 -21
- data/lib/assemblyai/transcripts/types/topic_detection_result_labels_item.rb +31 -15
- data/lib/assemblyai/transcripts/types/transcript.rb +512 -293
- data/lib/assemblyai/transcripts/types/transcript_custom_spelling.rb +30 -15
- data/lib/assemblyai/transcripts/types/transcript_language_code.rb +3 -2
- data/lib/assemblyai/transcripts/types/transcript_list.rb +33 -16
- data/lib/assemblyai/transcripts/types/transcript_list_item.rb +63 -30
- data/lib/assemblyai/transcripts/types/transcript_optional_params.rb +334 -191
- data/lib/assemblyai/transcripts/types/transcript_paragraph.rb +61 -33
- data/lib/assemblyai/transcripts/types/transcript_ready_notification.rb +30 -16
- data/lib/assemblyai/transcripts/types/transcript_sentence.rb +61 -33
- data/lib/assemblyai/transcripts/types/transcript_status.rb +2 -1
- data/lib/assemblyai/transcripts/types/transcript_utterance.rb +55 -31
- data/lib/assemblyai/transcripts/types/transcript_word.rb +55 -24
- data/lib/assemblyai/transcripts/types/word_search_match.rb +40 -20
- data/lib/assemblyai/transcripts/types/word_search_response.rb +36 -17
- data/lib/assemblyai/types/error.rb +32 -16
- data/lib/requests.rb +80 -34
- data/lib/types_export.rb +9 -8
- metadata +6 -5
- data/lib/assemblyai/realtime/types/audio_data.rb +0 -7
- data/lib/assemblyai/realtime/types/receive_message.rb +0 -87
- data/lib/assemblyai/realtime/types/send_message.rb +0 -74
@@ -2,81 +2,109 @@
|
|
2
2
|
|
3
3
|
require_relative "word"
|
4
4
|
require "date"
|
5
|
+
require "ostruct"
|
5
6
|
require "json"
|
6
7
|
|
7
8
|
module AssemblyAI
|
8
9
|
class Realtime
|
9
10
|
class PartialTranscript
|
10
|
-
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :message_type
|
13
|
+
# @return [Integer] Start time of audio sample relative to session start, in milliseconds
|
14
|
+
attr_reader :audio_start
|
15
|
+
# @return [Integer] End time of audio sample relative to session start, in milliseconds
|
16
|
+
attr_reader :audio_end
|
17
|
+
# @return [Float] The confidence score of the entire transcription, between 0 and 1
|
18
|
+
attr_reader :confidence
|
19
|
+
# @return [String] The partial transcript for your audio
|
20
|
+
attr_reader :text
|
21
|
+
# @return [Array<AssemblyAI::Realtime::Word>] An array of objects, with the information for each word in the transcription
|
22
|
+
# text.
|
23
|
+
# Includes the start and end time of the word in milliseconds, the confidence
|
24
|
+
# score of the word, and the text, which is the word itself.
|
25
|
+
attr_reader :words
|
26
|
+
# @return [DateTime] The timestamp for the partial transcript
|
27
|
+
attr_reader :created
|
28
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
29
|
+
attr_reader :additional_properties
|
30
|
+
# @return [Object]
|
31
|
+
attr_reader :_field_set
|
32
|
+
protected :_field_set
|
33
|
+
|
34
|
+
OMIT = Object.new
|
11
35
|
|
12
36
|
# @param message_type [String]
|
13
37
|
# @param audio_start [Integer] Start time of audio sample relative to session start, in milliseconds
|
14
38
|
# @param audio_end [Integer] End time of audio sample relative to session start, in milliseconds
|
15
39
|
# @param confidence [Float] The confidence score of the entire transcription, between 0 and 1
|
16
40
|
# @param text [String] The partial transcript for your audio
|
17
|
-
# @param words [Array<Realtime::Word>] An array of objects, with the information for each word in the transcription
|
18
|
-
#
|
41
|
+
# @param words [Array<AssemblyAI::Realtime::Word>] An array of objects, with the information for each word in the transcription
|
42
|
+
# text.
|
43
|
+
# Includes the start and end time of the word in milliseconds, the confidence
|
44
|
+
# score of the word, and the text, which is the word itself.
|
19
45
|
# @param created [DateTime] The timestamp for the partial transcript
|
20
46
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
21
|
-
# @return [Realtime::PartialTranscript]
|
47
|
+
# @return [AssemblyAI::Realtime::PartialTranscript]
|
22
48
|
def initialize(message_type:, audio_start:, audio_end:, confidence:, text:, words:, created:,
|
23
49
|
additional_properties: nil)
|
24
|
-
# @type [String]
|
25
50
|
@message_type = message_type
|
26
|
-
# @type [Integer] Start time of audio sample relative to session start, in milliseconds
|
27
51
|
@audio_start = audio_start
|
28
|
-
# @type [Integer] End time of audio sample relative to session start, in milliseconds
|
29
52
|
@audio_end = audio_end
|
30
|
-
# @type [Float] The confidence score of the entire transcription, between 0 and 1
|
31
53
|
@confidence = confidence
|
32
|
-
# @type [String] The partial transcript for your audio
|
33
54
|
@text = text
|
34
|
-
# @type [Array<Realtime::Word>] An array of objects, with the information for each word in the transcription text.
|
35
|
-
# Includes the start and end time of the word in milliseconds, the confidence score of the word, and the text, which is the word itself.
|
36
55
|
@words = words
|
37
|
-
# @type [DateTime] The timestamp for the partial transcript
|
38
56
|
@created = created
|
39
|
-
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
40
57
|
@additional_properties = additional_properties
|
58
|
+
@_field_set = {
|
59
|
+
"message_type": message_type,
|
60
|
+
"audio_start": audio_start,
|
61
|
+
"audio_end": audio_end,
|
62
|
+
"confidence": confidence,
|
63
|
+
"text": text,
|
64
|
+
"words": words,
|
65
|
+
"created": created
|
66
|
+
}
|
41
67
|
end
|
42
68
|
|
43
69
|
# Deserialize a JSON object to an instance of PartialTranscript
|
44
70
|
#
|
45
|
-
# @param json_object [
|
46
|
-
# @return [Realtime::PartialTranscript]
|
71
|
+
# @param json_object [String]
|
72
|
+
# @return [AssemblyAI::Realtime::PartialTranscript]
|
47
73
|
def self.from_json(json_object:)
|
48
74
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
49
75
|
parsed_json = JSON.parse(json_object)
|
50
|
-
message_type = struct
|
51
|
-
audio_start = struct
|
52
|
-
audio_end = struct
|
53
|
-
confidence = struct
|
54
|
-
text = struct
|
76
|
+
message_type = struct["message_type"]
|
77
|
+
audio_start = struct["audio_start"]
|
78
|
+
audio_end = struct["audio_end"]
|
79
|
+
confidence = struct["confidence"]
|
80
|
+
text = struct["text"]
|
55
81
|
words = parsed_json["words"]&.map do |v|
|
56
82
|
v = v.to_json
|
57
|
-
Realtime::Word.from_json(json_object: v)
|
83
|
+
AssemblyAI::Realtime::Word.from_json(json_object: v)
|
58
84
|
end
|
59
85
|
created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
|
60
|
-
new(
|
61
|
-
|
86
|
+
new(
|
87
|
+
message_type: message_type,
|
88
|
+
audio_start: audio_start,
|
89
|
+
audio_end: audio_end,
|
90
|
+
confidence: confidence,
|
91
|
+
text: text,
|
92
|
+
words: words,
|
93
|
+
created: created,
|
94
|
+
additional_properties: struct
|
95
|
+
)
|
62
96
|
end
|
63
97
|
|
64
98
|
# Serialize an instance of PartialTranscript to a JSON object
|
65
99
|
#
|
66
|
-
# @return [
|
100
|
+
# @return [String]
|
67
101
|
def to_json(*_args)
|
68
|
-
|
69
|
-
"message_type": @message_type,
|
70
|
-
"audio_start": @audio_start,
|
71
|
-
"audio_end": @audio_end,
|
72
|
-
"confidence": @confidence,
|
73
|
-
"text": @text,
|
74
|
-
"words": @words,
|
75
|
-
"created": @created
|
76
|
-
}.to_json
|
102
|
+
@_field_set&.to_json
|
77
103
|
end
|
78
104
|
|
79
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
105
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
106
|
+
# hash and check each fields type against the current object's property
|
107
|
+
# definitions.
|
80
108
|
#
|
81
109
|
# @param obj [Object]
|
82
110
|
# @return [Void]
|
@@ -1,47 +1,56 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "message_type"
|
4
|
+
require "ostruct"
|
4
5
|
require "json"
|
5
6
|
|
6
7
|
module AssemblyAI
|
7
8
|
class Realtime
|
8
9
|
class RealtimeBaseMessage
|
9
|
-
|
10
|
+
# @return [AssemblyAI::Realtime::MessageType] Describes the type of the message
|
11
|
+
attr_reader :message_type
|
12
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
attr_reader :additional_properties
|
14
|
+
# @return [Object]
|
15
|
+
attr_reader :_field_set
|
16
|
+
protected :_field_set
|
10
17
|
|
11
|
-
|
18
|
+
OMIT = Object.new
|
19
|
+
|
20
|
+
# @param message_type [AssemblyAI::Realtime::MessageType] Describes the type of the message
|
12
21
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
-
# @return [Realtime::RealtimeBaseMessage]
|
22
|
+
# @return [AssemblyAI::Realtime::RealtimeBaseMessage]
|
14
23
|
def initialize(message_type:, additional_properties: nil)
|
15
|
-
# @type [Realtime::MessageType] Describes the type of the message
|
16
24
|
@message_type = message_type
|
17
|
-
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
18
25
|
@additional_properties = additional_properties
|
26
|
+
@_field_set = { "message_type": message_type }
|
19
27
|
end
|
20
28
|
|
21
29
|
# Deserialize a JSON object to an instance of RealtimeBaseMessage
|
22
30
|
#
|
23
|
-
# @param json_object [
|
24
|
-
# @return [Realtime::RealtimeBaseMessage]
|
31
|
+
# @param json_object [String]
|
32
|
+
# @return [AssemblyAI::Realtime::RealtimeBaseMessage]
|
25
33
|
def self.from_json(json_object:)
|
26
34
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
27
|
-
|
28
|
-
message_type = struct.message_type
|
35
|
+
message_type = struct["message_type"]
|
29
36
|
new(message_type: message_type, additional_properties: struct)
|
30
37
|
end
|
31
38
|
|
32
39
|
# Serialize an instance of RealtimeBaseMessage to a JSON object
|
33
40
|
#
|
34
|
-
# @return [
|
41
|
+
# @return [String]
|
35
42
|
def to_json(*_args)
|
36
|
-
|
43
|
+
@_field_set&.to_json
|
37
44
|
end
|
38
45
|
|
39
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
46
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
47
|
+
# hash and check each fields type against the current object's property
|
48
|
+
# definitions.
|
40
49
|
#
|
41
50
|
# @param obj [Object]
|
42
51
|
# @return [Void]
|
43
52
|
def self.validate_raw(obj:)
|
44
|
-
obj.message_type.is_a?(Realtime::MessageType) != false || raise("Passed value for field obj.message_type is not the expected type, validation failed.")
|
53
|
+
obj.message_type.is_a?(AssemblyAI::Realtime::MessageType) != false || raise("Passed value for field obj.message_type is not the expected type, validation failed.")
|
45
54
|
end
|
46
55
|
end
|
47
56
|
end
|
@@ -2,75 +2,101 @@
|
|
2
2
|
|
3
3
|
require_relative "word"
|
4
4
|
require "date"
|
5
|
+
require "ostruct"
|
5
6
|
require "json"
|
6
7
|
|
7
8
|
module AssemblyAI
|
8
9
|
class Realtime
|
9
10
|
class RealtimeBaseTranscript
|
10
|
-
|
11
|
+
# @return [Integer] Start time of audio sample relative to session start, in milliseconds
|
12
|
+
attr_reader :audio_start
|
13
|
+
# @return [Integer] End time of audio sample relative to session start, in milliseconds
|
14
|
+
attr_reader :audio_end
|
15
|
+
# @return [Float] The confidence score of the entire transcription, between 0 and 1
|
16
|
+
attr_reader :confidence
|
17
|
+
# @return [String] The partial transcript for your audio
|
18
|
+
attr_reader :text
|
19
|
+
# @return [Array<AssemblyAI::Realtime::Word>] An array of objects, with the information for each word in the transcription
|
20
|
+
# text.
|
21
|
+
# Includes the start and end time of the word in milliseconds, the confidence
|
22
|
+
# score of the word, and the text, which is the word itself.
|
23
|
+
attr_reader :words
|
24
|
+
# @return [DateTime] The timestamp for the partial transcript
|
25
|
+
attr_reader :created
|
26
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
27
|
+
attr_reader :additional_properties
|
28
|
+
# @return [Object]
|
29
|
+
attr_reader :_field_set
|
30
|
+
protected :_field_set
|
31
|
+
|
32
|
+
OMIT = Object.new
|
11
33
|
|
12
34
|
# @param audio_start [Integer] Start time of audio sample relative to session start, in milliseconds
|
13
35
|
# @param audio_end [Integer] End time of audio sample relative to session start, in milliseconds
|
14
36
|
# @param confidence [Float] The confidence score of the entire transcription, between 0 and 1
|
15
37
|
# @param text [String] The partial transcript for your audio
|
16
|
-
# @param words [Array<Realtime::Word>] An array of objects, with the information for each word in the transcription
|
17
|
-
#
|
38
|
+
# @param words [Array<AssemblyAI::Realtime::Word>] An array of objects, with the information for each word in the transcription
|
39
|
+
# text.
|
40
|
+
# Includes the start and end time of the word in milliseconds, the confidence
|
41
|
+
# score of the word, and the text, which is the word itself.
|
18
42
|
# @param created [DateTime] The timestamp for the partial transcript
|
19
43
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
-
# @return [Realtime::RealtimeBaseTranscript]
|
44
|
+
# @return [AssemblyAI::Realtime::RealtimeBaseTranscript]
|
21
45
|
def initialize(audio_start:, audio_end:, confidence:, text:, words:, created:, additional_properties: nil)
|
22
|
-
# @type [Integer] Start time of audio sample relative to session start, in milliseconds
|
23
46
|
@audio_start = audio_start
|
24
|
-
# @type [Integer] End time of audio sample relative to session start, in milliseconds
|
25
47
|
@audio_end = audio_end
|
26
|
-
# @type [Float] The confidence score of the entire transcription, between 0 and 1
|
27
48
|
@confidence = confidence
|
28
|
-
# @type [String] The partial transcript for your audio
|
29
49
|
@text = text
|
30
|
-
# @type [Array<Realtime::Word>] An array of objects, with the information for each word in the transcription text.
|
31
|
-
# Includes the start and end time of the word in milliseconds, the confidence score of the word, and the text, which is the word itself.
|
32
50
|
@words = words
|
33
|
-
# @type [DateTime] The timestamp for the partial transcript
|
34
51
|
@created = created
|
35
|
-
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
36
52
|
@additional_properties = additional_properties
|
53
|
+
@_field_set = {
|
54
|
+
"audio_start": audio_start,
|
55
|
+
"audio_end": audio_end,
|
56
|
+
"confidence": confidence,
|
57
|
+
"text": text,
|
58
|
+
"words": words,
|
59
|
+
"created": created
|
60
|
+
}
|
37
61
|
end
|
38
62
|
|
39
63
|
# Deserialize a JSON object to an instance of RealtimeBaseTranscript
|
40
64
|
#
|
41
|
-
# @param json_object [
|
42
|
-
# @return [Realtime::RealtimeBaseTranscript]
|
65
|
+
# @param json_object [String]
|
66
|
+
# @return [AssemblyAI::Realtime::RealtimeBaseTranscript]
|
43
67
|
def self.from_json(json_object:)
|
44
68
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
45
69
|
parsed_json = JSON.parse(json_object)
|
46
|
-
audio_start = struct
|
47
|
-
audio_end = struct
|
48
|
-
confidence = struct
|
49
|
-
text = struct
|
70
|
+
audio_start = struct["audio_start"]
|
71
|
+
audio_end = struct["audio_end"]
|
72
|
+
confidence = struct["confidence"]
|
73
|
+
text = struct["text"]
|
50
74
|
words = parsed_json["words"]&.map do |v|
|
51
75
|
v = v.to_json
|
52
|
-
Realtime::Word.from_json(json_object: v)
|
76
|
+
AssemblyAI::Realtime::Word.from_json(json_object: v)
|
53
77
|
end
|
54
78
|
created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
|
55
|
-
new(
|
56
|
-
|
79
|
+
new(
|
80
|
+
audio_start: audio_start,
|
81
|
+
audio_end: audio_end,
|
82
|
+
confidence: confidence,
|
83
|
+
text: text,
|
84
|
+
words: words,
|
85
|
+
created: created,
|
86
|
+
additional_properties: struct
|
87
|
+
)
|
57
88
|
end
|
58
89
|
|
59
90
|
# Serialize an instance of RealtimeBaseTranscript to a JSON object
|
60
91
|
#
|
61
|
-
# @return [
|
92
|
+
# @return [String]
|
62
93
|
def to_json(*_args)
|
63
|
-
|
64
|
-
"audio_start": @audio_start,
|
65
|
-
"audio_end": @audio_end,
|
66
|
-
"confidence": @confidence,
|
67
|
-
"text": @text,
|
68
|
-
"words": @words,
|
69
|
-
"created": @created
|
70
|
-
}.to_json
|
94
|
+
@_field_set&.to_json
|
71
95
|
end
|
72
96
|
|
73
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
97
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
98
|
+
# hash and check each fields type against the current object's property
|
99
|
+
# definitions.
|
74
100
|
#
|
75
101
|
# @param obj [Object]
|
76
102
|
# @return [Void]
|
@@ -1,41 +1,50 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "ostruct"
|
3
4
|
require "json"
|
4
5
|
|
5
6
|
module AssemblyAI
|
6
7
|
class Realtime
|
7
8
|
class RealtimeError
|
8
|
-
|
9
|
+
# @return [String]
|
10
|
+
attr_reader :error
|
11
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
attr_reader :additional_properties
|
13
|
+
# @return [Object]
|
14
|
+
attr_reader :_field_set
|
15
|
+
protected :_field_set
|
16
|
+
|
17
|
+
OMIT = Object.new
|
9
18
|
|
10
19
|
# @param error [String]
|
11
20
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
-
# @return [Realtime::RealtimeError]
|
21
|
+
# @return [AssemblyAI::Realtime::RealtimeError]
|
13
22
|
def initialize(error:, additional_properties: nil)
|
14
|
-
# @type [String]
|
15
23
|
@error = error
|
16
|
-
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
17
24
|
@additional_properties = additional_properties
|
25
|
+
@_field_set = { "error": error }
|
18
26
|
end
|
19
27
|
|
20
28
|
# Deserialize a JSON object to an instance of RealtimeError
|
21
29
|
#
|
22
|
-
# @param json_object [
|
23
|
-
# @return [Realtime::RealtimeError]
|
30
|
+
# @param json_object [String]
|
31
|
+
# @return [AssemblyAI::Realtime::RealtimeError]
|
24
32
|
def self.from_json(json_object:)
|
25
33
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
26
|
-
|
27
|
-
error = struct.error
|
34
|
+
error = struct["error"]
|
28
35
|
new(error: error, additional_properties: struct)
|
29
36
|
end
|
30
37
|
|
31
38
|
# Serialize an instance of RealtimeError to a JSON object
|
32
39
|
#
|
33
|
-
# @return [
|
40
|
+
# @return [String]
|
34
41
|
def to_json(*_args)
|
35
|
-
|
42
|
+
@_field_set&.to_json
|
36
43
|
end
|
37
44
|
|
38
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
45
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
46
|
+
# hash and check each fields type against the current object's property
|
47
|
+
# definitions.
|
39
48
|
#
|
40
49
|
# @param obj [Object]
|
41
50
|
# @return [Void]
|
@@ -4,6 +4,7 @@ require "json"
|
|
4
4
|
require_relative "session_begins"
|
5
5
|
require_relative "partial_transcript"
|
6
6
|
require_relative "final_transcript"
|
7
|
+
require_relative "session_information"
|
7
8
|
require_relative "session_terminated"
|
8
9
|
require_relative "realtime_error"
|
9
10
|
|
@@ -12,70 +13,95 @@ module AssemblyAI
|
|
12
13
|
class RealtimeMessage
|
13
14
|
# Deserialize a JSON object to an instance of RealtimeMessage
|
14
15
|
#
|
15
|
-
# @param json_object [
|
16
|
-
# @return [Realtime::RealtimeMessage]
|
16
|
+
# @param json_object [String]
|
17
|
+
# @return [AssemblyAI::Realtime::RealtimeMessage]
|
17
18
|
def self.from_json(json_object:)
|
18
19
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
19
20
|
begin
|
20
|
-
Realtime::SessionBegins.validate_raw(obj: struct)
|
21
|
-
return Realtime::SessionBegins.from_json(json_object: json_object)
|
21
|
+
AssemblyAI::Realtime::SessionBegins.validate_raw(obj: struct)
|
22
|
+
return AssemblyAI::Realtime::SessionBegins.from_json(json_object: json_object) unless json_object.nil?
|
23
|
+
|
24
|
+
return nil
|
22
25
|
rescue StandardError
|
23
26
|
# noop
|
24
27
|
end
|
25
28
|
begin
|
26
|
-
Realtime::PartialTranscript.validate_raw(obj: struct)
|
27
|
-
return Realtime::PartialTranscript.from_json(json_object: json_object)
|
29
|
+
AssemblyAI::Realtime::PartialTranscript.validate_raw(obj: struct)
|
30
|
+
return AssemblyAI::Realtime::PartialTranscript.from_json(json_object: json_object) unless json_object.nil?
|
31
|
+
|
32
|
+
return nil
|
33
|
+
rescue StandardError
|
34
|
+
# noop
|
35
|
+
end
|
36
|
+
begin
|
37
|
+
AssemblyAI::Realtime::FinalTranscript.validate_raw(obj: struct)
|
38
|
+
return AssemblyAI::Realtime::FinalTranscript.from_json(json_object: json_object) unless json_object.nil?
|
39
|
+
|
40
|
+
return nil
|
28
41
|
rescue StandardError
|
29
42
|
# noop
|
30
43
|
end
|
31
44
|
begin
|
32
|
-
Realtime::
|
33
|
-
return Realtime::
|
45
|
+
AssemblyAI::Realtime::SessionInformation.validate_raw(obj: struct)
|
46
|
+
return AssemblyAI::Realtime::SessionInformation.from_json(json_object: json_object) unless json_object.nil?
|
47
|
+
|
48
|
+
return nil
|
34
49
|
rescue StandardError
|
35
50
|
# noop
|
36
51
|
end
|
37
52
|
begin
|
38
|
-
Realtime::SessionTerminated.validate_raw(obj: struct)
|
39
|
-
return Realtime::SessionTerminated.from_json(json_object: json_object)
|
53
|
+
AssemblyAI::Realtime::SessionTerminated.validate_raw(obj: struct)
|
54
|
+
return AssemblyAI::Realtime::SessionTerminated.from_json(json_object: json_object) unless json_object.nil?
|
55
|
+
|
56
|
+
return nil
|
40
57
|
rescue StandardError
|
41
58
|
# noop
|
42
59
|
end
|
43
60
|
begin
|
44
|
-
Realtime::RealtimeError.validate_raw(obj: struct)
|
45
|
-
return Realtime::RealtimeError.from_json(json_object: json_object)
|
61
|
+
AssemblyAI::Realtime::RealtimeError.validate_raw(obj: struct)
|
62
|
+
return AssemblyAI::Realtime::RealtimeError.from_json(json_object: json_object) unless json_object.nil?
|
63
|
+
|
64
|
+
return nil
|
46
65
|
rescue StandardError
|
47
66
|
# noop
|
48
67
|
end
|
49
68
|
struct
|
50
69
|
end
|
51
70
|
|
52
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
71
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
72
|
+
# hash and check each fields type against the current object's property
|
73
|
+
# definitions.
|
53
74
|
#
|
54
75
|
# @param obj [Object]
|
55
76
|
# @return [Void]
|
56
77
|
def self.validate_raw(obj:)
|
57
78
|
begin
|
58
|
-
return Realtime::SessionBegins.validate_raw(obj: obj)
|
79
|
+
return AssemblyAI::Realtime::SessionBegins.validate_raw(obj: obj)
|
80
|
+
rescue StandardError
|
81
|
+
# noop
|
82
|
+
end
|
83
|
+
begin
|
84
|
+
return AssemblyAI::Realtime::PartialTranscript.validate_raw(obj: obj)
|
59
85
|
rescue StandardError
|
60
86
|
# noop
|
61
87
|
end
|
62
88
|
begin
|
63
|
-
return Realtime::
|
89
|
+
return AssemblyAI::Realtime::FinalTranscript.validate_raw(obj: obj)
|
64
90
|
rescue StandardError
|
65
91
|
# noop
|
66
92
|
end
|
67
93
|
begin
|
68
|
-
return Realtime::
|
94
|
+
return AssemblyAI::Realtime::SessionInformation.validate_raw(obj: obj)
|
69
95
|
rescue StandardError
|
70
96
|
# noop
|
71
97
|
end
|
72
98
|
begin
|
73
|
-
return Realtime::SessionTerminated.validate_raw(obj: obj)
|
99
|
+
return AssemblyAI::Realtime::SessionTerminated.validate_raw(obj: obj)
|
74
100
|
rescue StandardError
|
75
101
|
# noop
|
76
102
|
end
|
77
103
|
begin
|
78
|
-
return Realtime::RealtimeError.validate_raw(obj: obj)
|
104
|
+
return AssemblyAI::Realtime::RealtimeError.validate_raw(obj: obj)
|
79
105
|
rescue StandardError
|
80
106
|
# noop
|
81
107
|
end
|
@@ -1,41 +1,50 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "ostruct"
|
3
4
|
require "json"
|
4
5
|
|
5
6
|
module AssemblyAI
|
6
7
|
class Realtime
|
7
8
|
class RealtimeTemporaryTokenResponse
|
8
|
-
|
9
|
+
# @return [String] The temporary authentication token for Streaming Speech-to-Text
|
10
|
+
attr_reader :token
|
11
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
attr_reader :additional_properties
|
13
|
+
# @return [Object]
|
14
|
+
attr_reader :_field_set
|
15
|
+
protected :_field_set
|
9
16
|
|
10
|
-
|
17
|
+
OMIT = Object.new
|
18
|
+
|
19
|
+
# @param token [String] The temporary authentication token for Streaming Speech-to-Text
|
11
20
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
-
# @return [Realtime::RealtimeTemporaryTokenResponse]
|
21
|
+
# @return [AssemblyAI::Realtime::RealtimeTemporaryTokenResponse]
|
13
22
|
def initialize(token:, additional_properties: nil)
|
14
|
-
# @type [String] The temporary authentication token for real-time transcription
|
15
23
|
@token = token
|
16
|
-
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
17
24
|
@additional_properties = additional_properties
|
25
|
+
@_field_set = { "token": token }
|
18
26
|
end
|
19
27
|
|
20
28
|
# Deserialize a JSON object to an instance of RealtimeTemporaryTokenResponse
|
21
29
|
#
|
22
|
-
# @param json_object [
|
23
|
-
# @return [Realtime::RealtimeTemporaryTokenResponse]
|
30
|
+
# @param json_object [String]
|
31
|
+
# @return [AssemblyAI::Realtime::RealtimeTemporaryTokenResponse]
|
24
32
|
def self.from_json(json_object:)
|
25
33
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
26
|
-
|
27
|
-
token = struct.token
|
34
|
+
token = struct["token"]
|
28
35
|
new(token: token, additional_properties: struct)
|
29
36
|
end
|
30
37
|
|
31
38
|
# Serialize an instance of RealtimeTemporaryTokenResponse to a JSON object
|
32
39
|
#
|
33
|
-
# @return [
|
40
|
+
# @return [String]
|
34
41
|
def to_json(*_args)
|
35
|
-
|
42
|
+
@_field_set&.to_json
|
36
43
|
end
|
37
44
|
|
38
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
45
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
46
|
+
# hash and check each fields type against the current object's property
|
47
|
+
# definitions.
|
39
48
|
#
|
40
49
|
# @param obj [Object]
|
41
50
|
# @return [Void]
|
@@ -9,37 +9,43 @@ module AssemblyAI
|
|
9
9
|
class RealtimeTranscript
|
10
10
|
# Deserialize a JSON object to an instance of RealtimeTranscript
|
11
11
|
#
|
12
|
-
# @param json_object [
|
13
|
-
# @return [Realtime::RealtimeTranscript]
|
12
|
+
# @param json_object [String]
|
13
|
+
# @return [AssemblyAI::Realtime::RealtimeTranscript]
|
14
14
|
def self.from_json(json_object:)
|
15
15
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
16
16
|
begin
|
17
|
-
Realtime::PartialTranscript.validate_raw(obj: struct)
|
18
|
-
return Realtime::PartialTranscript.from_json(json_object: json_object)
|
17
|
+
AssemblyAI::Realtime::PartialTranscript.validate_raw(obj: struct)
|
18
|
+
return AssemblyAI::Realtime::PartialTranscript.from_json(json_object: json_object) unless json_object.nil?
|
19
|
+
|
20
|
+
return nil
|
19
21
|
rescue StandardError
|
20
22
|
# noop
|
21
23
|
end
|
22
24
|
begin
|
23
|
-
Realtime::FinalTranscript.validate_raw(obj: struct)
|
24
|
-
return Realtime::FinalTranscript.from_json(json_object: json_object)
|
25
|
+
AssemblyAI::Realtime::FinalTranscript.validate_raw(obj: struct)
|
26
|
+
return AssemblyAI::Realtime::FinalTranscript.from_json(json_object: json_object) unless json_object.nil?
|
27
|
+
|
28
|
+
return nil
|
25
29
|
rescue StandardError
|
26
30
|
# noop
|
27
31
|
end
|
28
32
|
struct
|
29
33
|
end
|
30
34
|
|
31
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
35
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
36
|
+
# hash and check each fields type against the current object's property
|
37
|
+
# definitions.
|
32
38
|
#
|
33
39
|
# @param obj [Object]
|
34
40
|
# @return [Void]
|
35
41
|
def self.validate_raw(obj:)
|
36
42
|
begin
|
37
|
-
return Realtime::PartialTranscript.validate_raw(obj: obj)
|
43
|
+
return AssemblyAI::Realtime::PartialTranscript.validate_raw(obj: obj)
|
38
44
|
rescue StandardError
|
39
45
|
# noop
|
40
46
|
end
|
41
47
|
begin
|
42
|
-
return Realtime::FinalTranscript.validate_raw(obj: obj)
|
48
|
+
return AssemblyAI::Realtime::FinalTranscript.validate_raw(obj: obj)
|
43
49
|
rescue StandardError
|
44
50
|
# noop
|
45
51
|
end
|