-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.power
More file actions
73 lines (67 loc) · 1.8 KB
/
code.power
File metadata and controls
73 lines (67 loc) · 1.8 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
/**
* Get a list of members of an organization.
*
* @param string $orgName The organization name.
* @param int $page The page number.
* @param int $limit The number of members per page.
*
* @return array|null The organization members.
* @since 3.2.0
*/
public function list(
string $orgName,
int $page = 1,
int $limit = 10
): ?array
{
// Build the request path.
$path = "/orgs/{$orgName}/members";
// Get the URI and set query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Check if a user is a member of an organization.
*
* @param string $org The organization name.
* @param string $username The username.
*
* @return string Whether the user is a member of the organization.
* @since 3.2.0
*/
public function check(string $org, string $username): string
{
// Build the request path.
$path = "/orgs/{$org}/members/{$username}";
// Send the request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Remove a member from an organization.
*
* @param string $org The organization name.
* @param string $username The username of the user to remove.
*
* @return string Whether the user was successfully removed from the organization.
* @since 3.2.0
*/
public function remove(string $org, string $username): string
{
// Build the request path.
$path = "/orgs/{$org}/members/{$username}";
// Send the request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}