Skip to content

Commit ef04803

Browse files
committed
added TeamModel
1 parent 3b0731c commit ef04803

File tree

3 files changed

+83
-19
lines changed

3 files changed

+83
-19
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
vendor/
2-
lab/
3-
Models/TeamModel.php
2+
lab/

src/Models/TeamModel.php

Lines changed: 76 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,50 @@ public function getAllTeams()
4141
}
4242

4343
/**
44-
* @param $team_id
4544
* @return \Psr\Http\Message\ResponseInterface
4645
*/
47-
public function getGetTeamMembers($team_id)
46+
public function getAllTeamsUserIsMemberOf()
47+
{
48+
return $this->client->get(self::$endpoint . '/members');
49+
}
50+
51+
/**
52+
* @return \Psr\Http\Message\ResponseInterface
53+
*/
54+
public function getCountUnreadMessagesAndMentionsInTeamsUserIsMemberOf()
55+
{
56+
return $this->client->get(self::$endpoint . '/unread');
57+
}
58+
59+
/**
60+
* @param $team_id
61+
* @param $offset
62+
* @param $limit
63+
* @return null|\Psr\Http\Message\ResponseInterface
64+
*/
65+
public function getTeamMembers($team_id, $offset, $limit)
66+
{
67+
return $this->client->get(self::$endpoint . '/' . $team_id . '/members/' . $offset . '/' . $limit);
68+
}
69+
70+
/**
71+
* @param $team_id
72+
* @param $userId
73+
* @return null|\Psr\Http\Message\ResponseInterface
74+
*/
75+
public function getSingleTeamMember($team_id, $userId)
76+
{
77+
return $this->client->get(self::$endpoint . '/' . $team_id . '/members/' . $userId);
78+
}
79+
80+
/**
81+
* @param $team_id
82+
* @param array $requestOptions
83+
* @return null|\Psr\Http\Message\ResponseInterface
84+
*/
85+
public function getTeamMembersByIds($team_id, array $requestOptions)
4886
{
49-
return $this->client->get(self::$endpoint . '/members/' . $team_id);
87+
return $this->client->post(self::$endpoint . '/' . $team_id . '/members/ids', $requestOptions);
5088
}
5189

5290
/**
@@ -58,33 +96,60 @@ public function getTeam($team_id)
5896
return $this->client->get(self::$endpoint . '/' . $team_id . '/me');
5997
}
6098

99+
/**
100+
* @param $teamName
101+
* @return \Psr\Http\Message\ResponseInterface
102+
*/
103+
public function getTeamByName($teamName)
104+
{
105+
return $this->client->get(self::$endpoint . '/name/' . $teamName);
106+
}
107+
61108
/**
62109
* @param $team_id
63110
* @param array $requestOptions
64111
* @return \Psr\Http\Message\ResponseInterface
65112
*/
66113
public function updateTeam($team_id, array $requestOptions)
67114
{
68-
return $this->client->post(self::$endpoint . '/teams/' . $team_id . '/update', $requestOptions);
115+
return $this->client->post(self::$endpoint . '/' . $team_id . '/update', $requestOptions);
69116
}
70117

71118
/**
72-
* @param $team_id
73-
* @param $user_id
119+
* @param $team_id
74120
* @return \Psr\Http\Message\ResponseInterface
75121
*/
76-
public function addUser($team_id, $user_id)
122+
public function getStatsOfTeam($team_id)
77123
{
78-
return $this->client->post(self::$endpoint . '/teams/' . $team_id . '/add_user_to_team', compact('user_id'));
124+
return $this->client->get(self::$endpoint . '/' . $team_id . '/stats');
79125
}
80126

81127
/**
82128
* @param $team_id
83-
* @param $user_id
129+
* @param array $requestOptions
84130
* @return \Psr\Http\Message\ResponseInterface
85131
*/
86-
public function removeUser($team_id, $user_id)
132+
public function addUser($team_id, array $requestOptions)
133+
{
134+
return $this->client->post(self::$endpoint . '/' . $team_id . '/add_user_to_team', $requestOptions);
135+
}
136+
137+
/**
138+
* @param $team_id
139+
* @param array $requestOptions
140+
* @return null|\Psr\Http\Message\ResponseInterface
141+
*/
142+
public function removeUser($team_id, array $requestOptions)
143+
{
144+
return $this->client->post(self::$endpoint . '/' . $team_id . '/remove_user_from_team', $requestOptions);
145+
}
146+
147+
/**
148+
* @param $team_id
149+
* @return null|\Psr\Http\Message\ResponseInterface
150+
*/
151+
public function getAllSlashCommandsOfTeam($team_id)
87152
{
88-
return $this->client->post(self::$endpoint . '/teams/' . $team_id . '/remove_user_from_team', compact('user_id'));
153+
return $this->client->get(self::$endpoint . '/' . $team_id . '/commands/list_team_commands');
89154
}
90155
}

src/Models/UserModel.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function getUsersList($offset, $limit)
7676
*/
7777
public function getUsersListOfTeam($team_id, $offset, $limit)
7878
{
79-
$uri = '/teams/' . $team_id . '/' . self::$endpoint . '/' . $offset . '/' . $limit;
79+
$uri = TeamModel::$endpoint . '/' . $team_id . '/' . self::$endpoint . '/' . $offset . '/' . $limit;
8080
return $this->client->get($uri);
8181
}
8282

@@ -113,7 +113,7 @@ public function getUserByEmail($email)
113113
*/
114114
public function getUsersListByIds(array $requestOptions)
115115
{
116-
return $this->client->post(self::$endpoint . '/ids/', $requestOptions);
116+
return $this->client->post(self::$endpoint . '/ids', $requestOptions);
117117
}
118118

119119
/**
@@ -125,7 +125,7 @@ public function getUsersListByIds(array $requestOptions)
125125
*/
126126
public function getUserOfChannel($team_id, $channel_id, $offset, $limit)
127127
{
128-
$uri = '/teams/' . $team_id . '/channels/' . $channel_id . '/' . self::$endpoint . '/' . $offset . '/' . $limit;
128+
$uri = TeamModel::$endpoint . '/' . $team_id . '/channels/' . $channel_id . '/' . self::$endpoint . '/' . $offset . '/' . $limit;
129129
return $this->client->get($uri);
130130
}
131131

@@ -138,7 +138,7 @@ public function getUserOfChannel($team_id, $channel_id, $offset, $limit)
138138
*/
139139
public function getUserNotOfChannel($team_id, $channel_id, $offset, $limit)
140140
{
141-
$uri = '/teams/' . $team_id . '/channels/' . $channel_id . '/' . self::$endpoint . '/not_in_channel/' . $offset . '/' . $limit;
141+
$uri = TeamModel::$endpoint . '/' . $team_id . '/channels/' . $channel_id . '/' . self::$endpoint . '/not_in_channel/' . $offset . '/' . $limit;
142142
return $this->client->post($uri);
143143
}
144144

@@ -221,7 +221,7 @@ public function autocompleteUsers(array $requestOptions)
221221
*/
222222
public function autocompleteUsersOfTeam($team_id, array $requestOptions)
223223
{
224-
$uri = '/teams/' . $team_id . '/' . self::$endpoint . '/autocomplete';
224+
$uri = TeamModel::$endpoint . '/' . $team_id . '/' . self::$endpoint . '/autocomplete';
225225
return $this->client->get($uri, $requestOptions);
226226
}
227227

@@ -233,7 +233,7 @@ public function autocompleteUsersOfTeam($team_id, array $requestOptions)
233233
*/
234234
public function autocompleteUsersOfChannel($team_id, $channel_id, array $requestOptions)
235235
{
236-
$uri = '/teams/' . $team_id . '/channels/' . $channel_id . '/' . self::$endpoint . '/autocomplete';
236+
$uri = TeamModel::$endpoint . '/' . $team_id . '/channels/' . $channel_id . '/' . self::$endpoint . '/autocomplete';
237237
return $this->client->get($uri, $requestOptions);
238238
}
239239
}

0 commit comments

Comments
 (0)