Module: Legion::Extensions::MicrosoftTeams::Runners::Transcripts
- Extended by:
- Definitions
- Includes:
- Helpers::Lex, Helpers::Client
- Included in:
- Client
- Defined in:
- lib/legion/extensions/microsoft_teams/runners/transcripts.rb
Constant Summary
collapse
- CONTENT_TYPES =
{
vtt: 'text/vtt',
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
}.freeze
Class Method Summary
collapse
Instance Method Summary
collapse
#bot_connection, #graph_connection, #oauth_connection, #user_path
Class Method Details
.trigger_words ⇒ Object
18
19
20
|
# File 'lib/legion/extensions/microsoft_teams/runners/transcripts.rb', line 18
def self.trigger_words
%w[transcript transcripts vtt spoken]
end
|
Instance Method Details
#get_transcript(meeting_id:, transcript_id:, user_id: 'me') ⇒ Object
74
75
76
77
78
79
|
# File 'lib/legion/extensions/microsoft_teams/runners/transcripts.rb', line 74
def get_transcript(meeting_id:, transcript_id:, user_id: 'me', **)
response = graph_connection(**).get(
"#{user_path(user_id)}/onlineMeetings/#{meeting_id}/transcripts/#{transcript_id}"
)
{ result: response.body }
end
|
#get_transcript_content(meeting_id:, transcript_id:, user_id: 'me', format: :vtt) ⇒ Object
94
95
96
97
98
99
100
101
102
|
# File 'lib/legion/extensions/microsoft_teams/runners/transcripts.rb', line 94
def get_transcript_content(meeting_id:, transcript_id:, user_id: 'me', format: :vtt, **)
accept = CONTENT_TYPES.fetch(format)
response = graph_connection(**).get(
"#{user_path(user_id)}/onlineMeetings/#{meeting_id}/transcripts/#{transcript_id}/content"
) do |req|
req.['Accept'] = accept
end
{ result: response.body }
end
|
#list_transcripts(meeting_id:, user_id: 'me', top: 50, max_pages: 1) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/legion/extensions/microsoft_teams/runners/transcripts.rb', line 36
def list_transcripts(meeting_id:, user_id: 'me', top: 50, max_pages: 1, **)
params = { '$top' => top }
conn = graph_connection(**)
response = conn.get("#{user_path(user_id)}/onlineMeetings/#{meeting_id}/transcripts", params)
body = response.body
return { result: body } if max_pages <= 1
all_values = Array(body['value'] || body[:value])
next_link = body['@odata.nextLink'] || body[:'@odata.nextLink']
pages_fetched = 1
while next_link && pages_fetched < max_pages
response = conn.get(next_link)
page_body = response.body
items = page_body['value'] || page_body[:value]
all_values.concat(Array(items)) if items
next_link = page_body['@odata.nextLink'] || page_body[:'@odata.nextLink']
pages_fetched += 1
end
result = { '@odata.context' => body['@odata.context'] || body[:'@odata.context'],
'value' => all_values }
result['@odata.nextLink'] = next_link if next_link
{ result: result }
end
|