-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.power
More file actions
97 lines (88 loc) · 2.14 KB
/
code.power
File metadata and controls
97 lines (88 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/**
* List a team's members.
*
* @param int $teamId The team ID.
* @param int $pageNumber The page number of results to return (1-based).
* @param int $pageSize The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
int $teamId,
int $pageNumber = 1,
int $pageSize = 10
): ?array
{
// Build the request path.
$path = "/teams/{$teamId}/members";
// Get the URI object.
$uri = $this->uri->get($path);
// Add the query parameters for page number and page size.
$uri->setVar('page', $pageNumber);
$uri->setVar('limit', $pageSize);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* List a particular member of the team.
*
* @param int $id The team ID.
* @param string $username The user's username.
*
* @return object|null
* @since 3.2.0
**/
public function get(int $id, string $username): ?object
{
// Build the request path.
$path = "/teams/{$id}/members/{$username}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Add a team member.
*
* @param int $id The team ID.
* @param string $username The user's username.
*
* @return string
* @since 3.2.0
**/
public function add(int $id, string $username): string
{
// Build the request path.
$path = "/teams/{$id}/members/{$username}";
// Send the put request.
return $this->response->get(
$this->http->put(
$this->uri->get($path), ''
), 204, 'success'
);
}
/**
* Remove a team member.
*
* @param int $id The team ID.
* @param string $username The user's username.
*
* @return string
* @since 3.2.0
**/
public function remove(int $id, string $username): string
{
// Build the request path.
$path = "/teams/{$id}/members/{$username}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}