Module: Legion::Extensions::MicrosoftTeams::Runners::AppInstallations
- Includes:
- Helpers::Lex, Helpers::Client
- Defined in:
- lib/legion/extensions/microsoft_teams/runners/app_installations.rb
Class Method Summary
collapse
Instance Method Summary
collapse
#bot_connection, #graph_connection, #oauth_connection, #user_path
Class Method Details
.trigger_words ⇒ Object
12
13
14
|
# File 'lib/legion/extensions/microsoft_teams/runners/app_installations.rb', line 12
def self.trigger_words
%w[app apps addon addons installation installed]
end
|
Instance Method Details
#install_app_for_user(app_id:, user_id: 'me') ⇒ Object
54
55
56
57
58
59
60
|
# File 'lib/legion/extensions/microsoft_teams/runners/app_installations.rb', line 54
def install_app_for_user(app_id:, user_id: 'me', **)
payload = {
'teamsApp@odata.bind' => "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/#{app_id}"
}
response = graph_connection(**).post("#{user_path(user_id)}/teamwork/installedApps", payload)
{ result: response.body }
end
|
#list_installed_apps_for_user(user_id: 'me') ⇒ Object
24
25
26
27
|
# File 'lib/legion/extensions/microsoft_teams/runners/app_installations.rb', line 24
def list_installed_apps_for_user(user_id: 'me', **)
response = graph_connection(**).get("#{user_path(user_id)}/teamwork/installedApps")
{ result: response.body }
end
|
#list_installed_apps_in_chat(chat_id:) ⇒ Object
38
39
40
41
|
# File 'lib/legion/extensions/microsoft_teams/runners/app_installations.rb', line 38
def list_installed_apps_in_chat(chat_id:, **)
response = graph_connection(**).get("chats/#{chat_id}/installedApps")
{ result: response.body }
end
|
#uninstall_app_for_user(installation_id:, user_id: 'me') ⇒ Object
72
73
74
75
76
77
|
# File 'lib/legion/extensions/microsoft_teams/runners/app_installations.rb', line 72
def uninstall_app_for_user(installation_id:, user_id: 'me', **)
response = graph_connection(**).delete(
"#{user_path(user_id)}/teamwork/installedApps/#{installation_id}"
)
{ result: response.body }
end
|