Skip to content
Snippets Groups Projects
Commit 057c7bb6 authored by Z.J. van de Weg's avatar Z.J. van de Weg
Browse files

Update team methods [ci skip]

Former-commit-id: bbeef323
parent 239337fa
No related branches found
No related tags found
No related merge requests found
module Mattermost
class Command < Session
def self.all(team_id)
get("/api/v3/teams/#{team_id}/commands/list_team_commands")
get("/teams/#{team_id}/commands/list_team_commands").parsed_response
end
 
# params should be a hash, which supplies _at least_:
Loading
Loading
@@ -16,10 +16,13 @@ module Mattermost
description: 'Perform common operations on GitLab',
display_name: 'GitLab',
method: 'P',
user_name: 'GitLab'
user_name: 'GitLab',
trigger: 'gitlab',
}.merge(params)
 
post( "/api/v3/teams/#{team_id}/commands/create", command.to_json).parsed_response['token']
response = post( "/teams/#{team_id}/commands/create", body: command.to_json)
response.parsed_response['token']
end
end
end
module Mattermost
class Team < Session
# After normalization this returns an array of hashes
#
# [{"id"=>"paf573pj9t81urupw3fanozeda", "display_name"=>"my team", <snip>}]
def self.all
get('/api/v3/teams/all').parsed_response.values
def self.team_admin
body = get('/users/initial_load').parsed_response
return [] unless body['team_members']
team_ids = body['team_members'].map do |team|
team['team_id'] if team['roles'].split.include?('team_admin')
end.compact
body['teams'].select do |team|
team_ids.include?(team['id'])
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment