• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tylernathanreed / jira-client-php / 13857440588

14 Mar 2025 01:18PM UTC coverage: 70.825% (-0.06%) from 70.885%
13857440588

push

github

tylernathanreed
~ Fixed nested objects in test examples

9 of 9 new or added lines in 1 file covered. (100.0%)

524 existing lines in 407 files now uncovered.

4826 of 6814 relevant lines covered (70.82%)

8.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.02
/src/Operations/ProjectRoleActors.php
1
<?php
2

3
namespace Jira\Client\Operations;
4

5
use Jira\Client\Client;
6
use Jira\Client\Schema;
7

8
/** @phpstan-require-extends Client */
9
trait ProjectRoleActors
10
{
11
    /**
12
     * Sets the actors for a project role for a project, replacing all existing actors
13
     * 
14
     * To add actors to the project without overwriting the existing list, use "Add actors to project role"
15
     * 
16
     * **"Permissions" required:** *Administer Projects* "project permission" for the project or *Administer Jira* "global permission".
17
     * 
18
     * @link https://confluence.atlassian.com/x/yodKLg
19
     * @link https://confluence.atlassian.com/x/x4dKLg
20
     * 
21
     * @param string $projectIdOrKey The project ID or project key (case sensitive).
22
     * @param int $id The ID of the project role.
23
     *                Use "Get all project roles" to get a list of project role IDs.
24
     */
UNCOV
25
    public function setActors(
×
26
        Schema\ProjectRoleActorsUpdateBean $request,
27
        string $projectIdOrKey,
28
        int $id,
29
    ): Schema\ProjectRole {
UNCOV
30
        return $this->call(
×
UNCOV
31
            uri: '/rest/api/3/project/{projectIdOrKey}/role/{id}',
×
UNCOV
32
            method: 'put',
×
UNCOV
33
            body: $request,
×
UNCOV
34
            path: compact('projectIdOrKey', 'id'),
×
UNCOV
35
            success: 200,
×
UNCOV
36
            schema: Schema\ProjectRole::class,
×
UNCOV
37
        );
×
38
    }
39

40
    /**
41
     * Adds actors to a project role for the project
42
     * 
43
     * To replace all actors for the project, use "Set actors for project role"
44
     * 
45
     * This operation can be accessed anonymously
46
     * 
47
     * **"Permissions" required:** *Administer Projects* "project permission" for the project or *Administer Jira* "global permission".
48
     * 
49
     * @link https://confluence.atlassian.com/x/yodKLg
50
     * @link https://confluence.atlassian.com/x/x4dKLg
51
     * 
52
     * @param string $projectIdOrKey The project ID or project key (case sensitive).
53
     * @param int $id The ID of the project role.
54
     *                Use "Get all project roles" to get a list of project role IDs.
55
     */
56
    public function addActorUsers(
1✔
57
        Schema\ActorsMap $request,
58
        string $projectIdOrKey,
59
        int $id,
60
    ): Schema\ProjectRole {
61
        return $this->call(
1✔
62
            uri: '/rest/api/3/project/{projectIdOrKey}/role/{id}',
1✔
63
            method: 'post',
1✔
64
            body: $request,
1✔
65
            path: compact('projectIdOrKey', 'id'),
1✔
66
            success: 200,
1✔
67
            schema: Schema\ProjectRole::class,
1✔
68
        );
1✔
69
    }
70

71
    /**
72
     * Deletes actors from a project role for the project
73
     * 
74
     * To remove default actors from the project role, use "Delete default actors from project role"
75
     * 
76
     * This operation can be accessed anonymously
77
     * 
78
     * **"Permissions" required:** *Administer Projects* "project permission" for the project or *Administer Jira* "global permission".
79
     * 
80
     * @link https://confluence.atlassian.com/x/yodKLg
81
     * @link https://confluence.atlassian.com/x/x4dKLg
82
     * 
83
     * @param string $projectIdOrKey The project ID or project key (case sensitive).
84
     * @param int $id The ID of the project role.
85
     *                Use "Get all project roles" to get a list of project role IDs.
86
     * @param string $user The user account ID of the user to remove from the project role.
87
     * @param string $group The name of the group to remove from the project role.
88
     *                      This parameter cannot be used with the `groupId` parameter.
89
     *                      As a group's name can change, use of `groupId` is recommended.
90
     * @param string $groupId The ID of the group to remove from the project role.
91
     *                        This parameter cannot be used with the `group` parameter.
92
     */
93
    public function deleteActor(
1✔
94
        string $projectIdOrKey,
95
        int $id,
96
        ?string $user = null,
97
        ?string $group = null,
98
        ?string $groupId = null,
99
    ): true {
100
        return $this->call(
1✔
101
            uri: '/rest/api/3/project/{projectIdOrKey}/role/{id}',
1✔
102
            method: 'delete',
1✔
103
            query: compact('user', 'group', 'groupId'),
1✔
104
            path: compact('projectIdOrKey', 'id'),
1✔
105
            success: 204,
1✔
106
            schema: true,
1✔
107
        );
1✔
108
    }
109

110
    /**
111
     * Returns the "default actors" for the project role
112
     * 
113
     * **"Permissions" required:** *Administer Jira* "global permission".
114
     * 
115
     * @link https://confluence.atlassian.com/x/x4dKLg
116
     * 
117
     * @param int $id The ID of the project role.
118
     *                Use "Get all project roles" to get a list of project role IDs.
119
     */
120
    public function getProjectRoleActorsForRole(
1✔
121
        int $id,
122
    ): Schema\ProjectRole {
123
        return $this->call(
1✔
124
            uri: '/rest/api/3/role/{id}/actors',
1✔
125
            method: 'get',
1✔
126
            path: compact('id'),
1✔
127
            success: 200,
1✔
128
            schema: Schema\ProjectRole::class,
1✔
129
        );
1✔
130
    }
131

132
    /**
133
     * Adds "default actors" to a role.
134
     * You may add groups or users, but you cannot add groups and users in the same request
135
     * 
136
     * Changing a project role's default actors does not affect project role members for projects already created
137
     * 
138
     * **"Permissions" required:** *Administer Jira* "global permission".
139
     * 
140
     * @link https://confluence.atlassian.com/x/x4dKLg
141
     * 
142
     * @param int $id The ID of the project role.
143
     *                Use "Get all project roles" to get a list of project role IDs.
144
     */
145
    public function addProjectRoleActorsToRole(
1✔
146
        Schema\ActorInputBean $request,
147
        int $id,
148
    ): Schema\ProjectRole {
149
        return $this->call(
1✔
150
            uri: '/rest/api/3/role/{id}/actors',
1✔
151
            method: 'post',
1✔
152
            body: $request,
1✔
153
            path: compact('id'),
1✔
154
            success: 200,
1✔
155
            schema: Schema\ProjectRole::class,
1✔
156
        );
1✔
157
    }
158

159
    /**
160
     * Deletes the "default actors" from a project role.
161
     * You may delete a group or user, but you cannot delete a group and a user in the same request
162
     * 
163
     * Changing a project role's default actors does not affect project role members for projects already created
164
     * 
165
     * **"Permissions" required:** *Administer Jira* "global permission".
166
     * 
167
     * @link https://confluence.atlassian.com/x/x4dKLg
168
     * 
169
     * @param int $id The ID of the project role.
170
     *                Use "Get all project roles" to get a list of project role IDs.
171
     * @param string $user The user account ID of the user to remove as a default actor.
172
     * @param string $groupId The group ID of the group to be removed as a default actor.
173
     *                        This parameter cannot be used with the `group` parameter.
174
     * @param string $group The group name of the group to be removed as a default actor.This parameter cannot be used with the `groupId` parameter.
175
     *                      As a group's name can change, use of `groupId` is recommended.
176
     */
177
    public function deleteProjectRoleActorsFromRole(
1✔
178
        int $id,
179
        ?string $user = null,
180
        ?string $groupId = null,
181
        ?string $group = null,
182
    ): Schema\ProjectRole {
183
        return $this->call(
1✔
184
            uri: '/rest/api/3/role/{id}/actors',
1✔
185
            method: 'delete',
1✔
186
            query: compact('user', 'groupId', 'group'),
1✔
187
            path: compact('id'),
1✔
188
            success: 200,
1✔
189
            schema: Schema\ProjectRole::class,
1✔
190
        );
1✔
191
    }
192
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc