Module: Legion::Extensions::MicrosoftTeams::Runners::AppInstallations
- Extended by:
- Definitions
- 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
13
14
15
|
# File 'lib/legion/extensions/microsoft_teams/runners/app_installations.rb', line 13
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
55
56
57
58
59
60
61
|
# File 'lib/legion/extensions/microsoft_teams/runners/app_installations.rb', line 55
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
25
26
27
28
|
# File 'lib/legion/extensions/microsoft_teams/runners/app_installations.rb', line 25
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
39
40
41
42
|
# File 'lib/legion/extensions/microsoft_teams/runners/app_installations.rb', line 39
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
73
74
75
76
77
78
|
# File 'lib/legion/extensions/microsoft_teams/runners/app_installations.rb', line 73
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
|