Class: Mattermost::Team

Inherits:
Client
  • Object
show all
Defined in:
lib/mattermost/team.rb

Instance Attribute Summary

Attributes inherited from Client

#user

Instance Method Summary collapse

Methods inherited from Client

#initialize, #with_session

Constructor Details

This class inherits a constructor from Mattermost::Client

Instance Method Details

#allObject

Returns all teams that the current user is a member of



6
7
8
# File 'lib/mattermost/team.rb', line 6

def all
  session_get("/api/v4/users/me/teams")
end

#create(name:, display_name:, type:) ⇒ Object

Creates a team on the linked Mattermost instance, the team admin will be the ‘current_user` passed to the Mattermost::Client instance



12
13
14
15
16
17
18
# File 'lib/mattermost/team.rb', line 12

def create(name:, display_name:, type:)
  session_post('/api/v4/teams', body: {
    name: name,
    display_name: display_name,
    type: type
  }.to_json)
end

#destroy(team_id:) ⇒ Object

The deletion is done async, so the response is fast. On the mattermost side, this triggers an soft deletion



22
23
24
# File 'lib/mattermost/team.rb', line 22

def destroy(team_id:)
  session_delete("/api/v4/teams/#{team_id}")
end