devmoath / jira-php
Jira PHP是一个增强型PHP API客户端,允许您与Jira API和服务台API进行交互
v0.1.0
2023-02-12 00:46 UTC
Requires
- php: ^8.1.0
- guzzlehttp/guzzle: ^7.5.0
Requires (Dev)
- laravel/pint: ^1.2.0
- nunomaduro/collision: ^7.0.0
- pestphp/pest: ^2.0.0
- pestphp/pest-plugin-mock: ^2.0.0
- phpstan/extension-installer: ^1.2
- phpstan/phpstan: ^1.8.6
- phpstan/phpstan-strict-rules: ^1.4
- rector/rector: ^0.14.4
- symfony/var-dumper: ^6.2.0
README
Jira PHP是一个增强型PHP API客户端,允许您与Jira API和服务台API进行交互。
开始使用
需要PHP 8.1+
首先,通过Composer包管理器安装devmoath/jira-php
composer require devmoath/jira-php
然后,与Jira的API进行交互
$client = Jira::client('USERNAME', 'PASSWORD', 'jira.domain.com'); $result = $client->issues()->search(); echo $result['issues'][0]['key']; // KEY-1000
用法
附件资源
get函数
检索附件的元数据。
$client->attachments()->get(id: '1000');
响应示例
[
'self' => 'https://www.example.com/jira/rest/api/2.0/attachments/10000',
'filename' => 'picture.jpg',
'author' => [
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'avatarUrls' => [
'48x48' => 'https://www.example.com/jira/secure/useravatar?size=large&ownerId=fred',
'24x24' => 'https://www.example.com/jira/secure/useravatar?size=small&ownerId=fred',
'16x16' => 'https://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred',
'32x32' => 'https://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred',
],
'displayName' => 'Fred F. User',
'active' => false,
],
'created' => '2019-02-09T10:08:20.478+0000',
'size' => 23123,
'mimeType' => 'image/jpeg',
'content' => 'https://www.example.com/jira/attachments/10000',
'thumbnail' => 'https://www.example.com/jira/secure/thumbnail/10000',
];
remove函数
删除附件。
$client->attachments()->remove(id: '1000');
响应示例
null
download函数
下载附件内容。
$attachment = $client->attachments()->get(id: '1000'); $client->attachments()->download(url: $attachment['content']);
响应示例
{"a":"b"}\n
客户资源
create函数
创建一个与任何服务项目无关的客户。
$client->customers()->create( body: [ 'fullName' => 'name', 'email' => 'name@example.com', ], );
响应示例
[
'name' => 'fred',
'key' => 'fred',
'emailAddress' => 'fred@example.com',
'displayName' => 'Fred F. User',
'active' => true,
'timeZone' => 'Australia/Sydney',
'_links' => [
'jiraRest' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'avatarUrls' => [
'48x48' => 'https://www.example.com/jira/secure/useravatar?size=large&ownerId=fred',
'24x24' => 'https://www.example.com/jira/secure/useravatar?size=small&ownerId=fred',
'16x16' => 'https://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred',
'32x32' => 'https://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred',
],
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
],
];
组资源
create函数
通过给定的组参数创建一个组。
$client->groups()->create( body: [ 'name' => 'group name', ], );
响应示例
[
'name' => 'jira-administrators',
'self' => 'https://www.example.com/jira/rest/api/2/group?groupname=jira-administrators',
'users' => [
'size' => 1,
'items' => [
[
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'displayName' => 'Fred F. User',
'active' => false,
],
],
'max-results' => 50,
'start-index' => 0,
'end-index' => 0,
],
'expand' => 'users',
];
remove函数
通过给定的组参数删除一个组。
$client->groups()->remove( query: [ 'name' => 'group name', ], );
响应示例
null
getUsers函数
返回一个分页的用户列表,这些用户是特定组及其子组的成员。
$client->groups()->getUsers( query: [ 'groupname' => 'group name', ], );
响应示例
[
'self' => 'https://example.com/rest/api/2/group/member?groupname=admin&startAt=2&maxResults=2',
'nextPage' => 'https://example.com/rest/api/2/group/member?groupname=admin&startAt=4&maxResults=2',
'maxResults' => 2,
'startAt' => 3,
'total' => 5,
'isLast' => false,
'values' => [
[
'self' => 'https://example/jira/rest/api/2/user?username=fred',
'name' => 'Fred',
'key' => 'fred',
'emailAddress' => 'fred@atlassian.com',
'avatarUrls' => [],
'displayName' => 'Fred',
'active' => true,
'timeZone' => 'Australia/Sydney',
],
[
'self' => 'https://example/jira/rest/api/2/user?username=barney',
'name' => 'Barney',
'key' => 'barney',
'emailAddress' => 'barney@atlassian.com',
'avatarUrls' => [],
'displayName' => 'Barney',
'active' => false,
'timeZone' => 'Australia/Sydney',
],
],
];
addUser函数
将给定用户添加到组中。
$client->groups()->addUser( query: [ 'groupname' => 'group name', ], body: [ 'name' => 'user name', ], );
响应示例
[
'name' => 'example',
'self' => 'url',
'users' => [],
'expand' => '',
];
removeUser函数
从组中删除给定用户。
$client->groups()->removeUser( query: [ 'groupname' => 'group name', 'username' => 'user name', ], );
响应示例
null
问题资源
create函数
从JSON表示创建问题或子任务。
$client ->issues() ->create(body: [...]);
响应示例
[
'id' => '10000',
'key' => 'TST-24',
'self' => 'https://www.example.com/jira/rest/api/2/issue/10000',
];
bulk函数
从JSON表示创建问题或子任务。
$client ->issues() ->bulk(body: [ [...], [...], [...] ]);
响应示例
[
'issues' => [
[
'id' => '10000',
'key' => 'TST-24',
'self' => 'https://www.example.com/jira/rest/api/2/issue/10000',
],
[
'id' => '10001',
'key' => 'TST-25',
'self' => 'https://www.example.com/jira/rest/api/2/issue/10001',
],
],
'errors' => [],
];
get函数
返回给定问题键的问题的完整表示。
$client->issues()->get(id: 'KEY-1000', query: [...]);
响应示例
[
'expand' => 'renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations',
'id' => '10002',
'self' => 'https://www.example.com/jira/rest/api/2/issue/10002',
'key' => 'EX-1',
'fields' => [
'watcher' => [
'self' => 'https://www.example.com/jira/rest/api/2/issue/EX-1/watchers',
'isWatching' => false,
'watchCount' => 1,
'watchers' => [
[
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'displayName' => 'Fred F. User',
'active' => false,
],
],
],
'attachment' => [
[
'self' => 'https://www.example.com/jira/rest/api/2.0/attachments/10000',
'filename' => 'picture.jpg',
'author' => [
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'avatarUrls' => [
'48x48' => 'https://www.example.com/jira/secure/useravatar?size=large&ownerId=fred',
'24x24' => 'https://www.example.com/jira/secure/useravatar?size=small&ownerId=fred',
'16x16' => 'https://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred',
'32x32' => 'https://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred',
],
'displayName' => 'Fred F. User',
'active' => false,
],
'created' => '2019-02-09T10:08:20.478+0000',
'size' => 23123,
'mimeType' => 'image/jpeg',
'content' => 'https://www.example.com/jira/attachments/10000',
'thumbnail' => 'https://www.example.com/jira/secure/thumbnail/10000',
],
],
'sub-tasks' => [
[
'id' => '10000',
'type' => [
'id' => '10000',
'name' => '',
'inward' => 'Parent',
'outward' => 'Sub-task',
],
'outwardIssue' => [
'id' => '10003',
'key' => 'EX-2',
'self' => 'https://www.example.com/jira/rest/api/2/issue/EX-2',
'fields' => [
'status' => [
'iconUrl' => 'https://www.example.com/jira/images/icons/statuses/open.png',
'name' => 'Open',
],
],
],
],
],
'description' => 'example bug report',
'project' => [
'self' => 'https://www.example.com/jira/rest/api/2/project/EX',
'id' => '10000',
'key' => 'EX',
'name' => 'Example',
'avatarUrls' => [
'48x48' => 'https://www.example.com/jira/secure/projectavatar?size=large&pid=10000',
'24x24' => 'https://www.example.com/jira/secure/projectavatar?size=small&pid=10000',
'16x16' => 'https://www.example.com/jira/secure/projectavatar?size=xsmall&pid=10000',
'32x32' => 'https://www.example.com/jira/secure/projectavatar?size=medium&pid=10000',
],
'projectCategory' => [
'self' => 'https://www.example.com/jira/rest/api/2/projectCategory/10000',
'id' => '10000',
'name' => 'FIRST',
'description' => 'First Project Category',
],
],
'comment' => [
[
'self' => 'https://www.example.com/jira/rest/api/2/issue/10010/comment/10000',
'id' => '10000',
'author' => [
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'displayName' => 'Fred F. User',
'active' => false,
],
'body' => 'Lorem ipsum dolor sit amet.',
'updateAuthor' => [
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'displayName' => 'Fred F. User',
'active' => false,
],
'created' => '2019-02-09T10:08:20.180+0000',
'updated' => '2019-02-09T10:08:20.181+0000',
'visibility' => [
'type' => 'role',
'value' => 'Administrators',
],
],
],
'issuelinks' => [
[
'id' => '10001',
'type' => [
'id' => '10000',
'name' => 'Dependent',
'inward' => 'depends on',
'outward' => 'is depended by',
],
'outwardIssue' => [
'id' => '10004L',
'key' => 'PRJ-2',
'self' => 'https://www.example.com/jira/rest/api/2/issue/PRJ-2',
'fields' => [
'status' => [
'iconUrl' => 'https://www.example.com/jira//images/icons/statuses/open.png',
'name' => 'Open',
],
],
],
],
[
'id' => '10002',
'type' => [
'id' => '10000',
'name' => 'Dependent',
'inward' => 'depends on',
'outward' => 'is depended by',
],
'inwardIssue' => [
'id' => '10004',
'key' => 'PRJ-3',
'self' => 'https://www.example.com/jira/rest/api/2/issue/PRJ-3',
'fields' => [
'status' => [
'iconUrl' => 'https://www.example.com/jira//images/icons/statuses/open.png',
'name' => 'Open',
],
],
],
],
],
'worklog' => [
[
'self' => 'https://www.example.com/jira/rest/api/2/issue/10010/worklog/10000',
'author' => [
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'displayName' => 'Fred F. User',
'active' => false,
],
'updateAuthor' => [
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'displayName' => 'Fred F. User',
'active' => false,
],
'comment' => 'I did some work here.',
'updated' => '2019-02-09T10:08:20.486+0000',
'visibility' => [
'type' => 'group',
'value' => 'jira-developers',
],
'started' => '2019-02-09T10:08:20.486+0000',
'timeSpent' => '3h 20m',
'timeSpentSeconds' => 12000,
'id' => '100028',
'issueId' => '10002',
],
],
'updated' => 1,
'timetracking' => [
'originalEstimate' => '10m',
'remainingEstimate' => '3m',
'timeSpent' => '6m',
'originalEstimateSeconds' => 600,
'remainingEstimateSeconds' => 200,
'timeSpentSeconds' => 400,
],
],
'names' => [
'watcher' => 'watcher',
'attachment' => 'attachment',
'sub-tasks' => 'sub-tasks',
'description' => 'description',
'project' => 'project',
'comment' => 'comment',
'issuelinks' => 'issuelinks',
'worklog' => 'worklog',
'updated' => 'updated',
'timetracking' => 'timetracking',
],
'schema' => [],
];
delete函数
删除问题。
$client->issues()->delete(id: 'KEY-1000', query: [...]);
响应示例
null
edit函数
从JSON表示编辑问题。
$client->issues()->edit(id: 'KEY-1000', body: [...], query: [...]);
响应示例
null
archive函数
存档问题。
$client->issues()->archive(id: 'KEY-1000');
响应示例
null
assign函数
将问题分配给用户。
$client->issues()->assign(id: 'KEY-1000', body: [...]);
响应示例
null
getComments函数
返回问题的所有评论。
$client->issues()->getComments(id: 'KEY-1000', query: [...]);
响应示例
[
'startAt' => 0,
'maxResults' => 1,
'total' => 1,
'comments' => [
[
'self' => 'https://www.example.com/jira/rest/api/2/issue/10010/comment/10000',
'id' => '10000',
'author' => [
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'displayName' => 'Fred F. User',
'active' => false,
],
'body' => 'Lorem ipsum dolor sit amet.',
'updateAuthor' => [
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'displayName' => 'Fred F. User',
'active' => false,
],
'created' => '2019-02-09T10:08:20.180+0000',
'updated' => '2019-02-09T10:08:20.181+0000',
'visibility' => [
'type' => 'role',
'value' => 'Administrators',
],
],
],
];
addComment函数
向问题添加新评论。
$client->issues()->addComment(id: 'KEY-1000', body: [...], query: [...]);
响应示例
[
'self' => 'https://www.example.com/jira/rest/api/2/issue/10010/comment/10000',
'id' => '10000',
'author' => [
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'displayName' => 'Fred F. User',
'active' => false,
],
'body' => 'Lorem ipsum dolor sit amet.',
'updateAuthor' => [
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'displayName' => 'Fred F. User',
'active' => false,
],
'created' => '2019-02-09T10:08:20.180+0000',
'updated' => '2019-02-09T10:08:20.181+0000',
'visibility' => [
'type' => 'role',
'value' => 'Administrators',
],
];
updateComment函数
使用其JSON表示更新现有评论。
$client->issues()->updateComment(id: 'KEY-1000', commentId: '10000', body: [...], query: [...]);
响应示例
[
'self' => 'https://www.example.com/jira/rest/api/2/issue/10010/comment/10000',
'id' => '10000',
'author' => [
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'displayName' => 'Fred F. User',
'active' => false,
],
'body' => 'Lorem ipsum dolor sit amet.',
'updateAuthor' => [
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'displayName' => 'Fred F. User',
'active' => false,
],
'created' => '2019-02-09T10:08:20.180+0000',
'updated' => '2019-02-09T10:08:20.181+0000',
'visibility' => [
'type' => 'role',
'value' => 'Administrators',
],
];
deleteComment函数
删除现有评论。
$client->issues()->deleteComment(id: 'KEY-1000', commentId: '10000', query: [...]);
响应示例
null
getComment函数
返回单个评论。
$client->issues()->getComment(id: 'KEY-1000', commentId: '10000', query: [...]);
响应示例
[
'self' => 'https://www.example.com/jira/rest/api/2/issue/10010/comment/10000',
'id' => '10000',
'author' => [
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'displayName' => 'Fred F. User',
'active' => false,
],
'body' => 'Lorem ipsum dolor sit amet.',
'updateAuthor' => [
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'displayName' => 'Fred F. User',
'active' => false,
],
'created' => '2019-02-09T10:08:20.180+0000',
'updated' => '2019-02-09T10:08:20.181+0000',
'visibility' => [
'type' => 'role',
'value' => 'Administrators',
],
];
getTransitions函数
获取当前用户可以对此问题执行的可能转换列表,以及所需字段及其类型。
$client->issues()->getTransitions(id: 'KEY-1000', query: [...]);
响应示例
[
'expand' => 'transitions',
'transitions' => [
[
'id' => '2',
'name' => 'Close Issue',
'to' => [
'self' => 'https://:8090/jira/rest/api/2.0/status/10000',
'description' => 'The issue is currently being worked on.',
'iconUrl' => 'https://:8090/jira/images/icons/progress.gif',
'name' => 'In Progress',
'id' => '10000',
'statusCategory' => [
'self' => 'https://:8090/jira/rest/api/2.0/statuscategory/1',
'id' => 1,
'key' => 'in-flight',
'colorName' => 'yellow',
'name' => 'In Progress',
],
],
'fields' => [
'summary' => [
'required' => false,
'schema' => [
'type' => 'array',
'items' => 'option',
'custom' => 'com.atlassian.jira.plugin.system.customfieldtypes:multiselect',
'customId' => 10001,
],
'name' => 'My Multi Select',
'hasDefaultValue' => false,
'operations' => ['set', 'add'],
'allowedValues' => ['red', 'blue'],
],
],
],
[
'id' => '711',
'name' => 'QA Review',
'to' => [
'self' => 'https://:8090/jira/rest/api/2.0/status/5',
'description' => 'The issue is closed.',
'iconUrl' => 'https://:8090/jira/images/icons/closed.gif',
'name' => 'Closed',
'id' => '5',
'statusCategory' => [
'self' => 'https://:8090/jira/rest/api/2.0/statuscategory/9',
'id' => 9,
'key' => 'completed',
'colorName' => 'green',
],
],
'fields' => [
'summary' => [
'required' => false,
'schema' => [
'type' => 'array',
'items' => 'option',
'custom' => 'com.atlassian.jira.plugin.system.customfieldtypes:multiselect',
'customId' => 10001,
],
'name' => 'My Multi Select',
'hasDefaultValue' => false,
'operations' => ['set', 'add'],
'allowedValues' => ['red', 'blue'],
],
'colour' => [
'required' => false,
'schema' => [
'type' => 'array',
'items' => 'option',
'custom' => 'com.atlassian.jira.plugin.system.customfieldtypes:multiselect',
'customId' => 10001,
],
'name' => 'My Multi Select',
'hasDefaultValue' => false,
'operations' => ['set', 'add'],
'allowedValues' => ['red', 'blue'],
],
],
],
],
];
doTransition函数
对问题执行转换。
$client->issues()->doTransition(id: 'KEY-1000', body: [...], query: [...]);
响应示例
null
attach函数
将一个或多个附件添加到问题中。
$client->issues()->attach(id: 'KEY-1000', body: [...]);
响应示例
[
[
'self' => 'https://www.example.com/jira/rest/api/2.0/attachments/10000',
'filename' => 'picture.jpg',
'author' => [
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'avatarUrls' => [
'48x48' => 'https://www.example.com/jira/secure/useravatar?size=large&ownerId=fred',
'24x24' => 'https://www.example.com/jira/secure/useravatar?size=small&ownerId=fred',
'16x16' => 'https://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred',
'32x32' => 'https://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred',
],
'displayName' => 'Fred F. User',
'active' => false,
],
'created' => '2019-02-09T10:08:20.478+0000',
'size' => 23123,
'mimeType' => 'image/jpeg',
'content' => 'https://www.example.com/jira/attachments/10000',
'thumbnail' => 'https://www.example.com/jira/secure/thumbnail/10000',
],
[
'self' => 'https://www.example.com/jira/rest/api/2.0/attachments/10001',
'filename' => 'dbeuglog.txt',
'author' => [
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'avatarUrls' => [
'48x48' => 'https://www.example.com/jira/secure/useravatar?size=large&ownerId=fred',
'24x24' => 'https://www.example.com/jira/secure/useravatar?size=small&ownerId=fred',
'16x16' => 'https://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred',
'32x32' => 'https://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred',
],
'displayName' => 'Fred F. User',
'active' => false,
],
'created' => '2019-02-09T10:08:20.478+0000',
'size' => 2460,
'mimeType' => 'text/plain',
'content' => 'https://www.example.com/jira/attachments/10001',
'thumbnail' => 'https://www.example.com/jira/secure/thumbnail/10002',
],
];
search函数
使用JQL搜索问题。
$client->issues()->search(query: [...]);
响应示例
[
'expand' => 'names,schema',
'startAt' => 0,
'maxResults' => 50,
'total' => 1,
'issues' => [
[
'expand' => '',
'id' => '10001',
'self' => 'https://www.example.com/jira/rest/api/2/issue/10001',
'key' => 'HSP-1',
],
],
];
请求资源
create函数
在服务项目中创建客户请求。
$client->requests()->create(body: [...]);
响应示例
[
'_expands' => ['participant', 'status', 'sla', 'requestType', 'serviceDesk'],
'issueId' => '107001',
'issueKey' => 'HELPDESK-1',
'requestTypeId' => '25',
'serviceDeskId' => '10',
'createdDate' => [
'iso8601' => '2015-10-08T14:42:00+0700',
'jira' => '2015-10-08T14:42:00.000+0700',
'friendly' => 'Monday 14:42 PM',
'epochMillis' => 1444290120000,
],
'reporter' => [
'name' => 'fred',
'key' => 'fred',
'emailAddress' => 'fred@example.com',
'displayName' => 'Fred F. User',
'active' => true,
'timeZone' => 'Australia/Sydney',
'_links' => [
'jiraRest' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'avatarUrls' => [
'48x48' => 'https://www.example.com/jira/secure/useravatar?size=large&ownerId=fred',
'24x24' => 'https://www.example.com/jira/secure/useravatar?size=small&ownerId=fred',
'16x16' => 'https://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred',
'32x32' => 'https://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred',
],
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
],
],
'requestFieldValues' => [
[
'fieldId' => 'summary',
'label' => 'What do you need?',
'value' => 'Request JSD help via REST',
],
[
'fieldId' => 'description',
'label' => 'Why do you need this?',
'value' => 'I need a new mouse for my Mac',
],
],
'currentStatus' => [
'status' => 'Waiting for Support',
'statusDate' => [
'iso8601' => '2015-10-08T14:01:00+0700',
'jira' => '2015-10-08T14:01:00.000+0700',
'friendly' => 'Today 14:01 PM',
'epochMillis' => 1444287660000,
],
],
'_links' => [
'jiraRest' => 'https://host:port/context/rest/api/2/issue/107001',
'web' => 'https://host:port/context/servicedesk/customer/portal/10/HELPDESK-1',
'self' => 'https://host:port/context/rest/servicedeskapi/request/107001',
],
];
用户资源
update函数
修改用户。
$client->users()->update(body: [...]);
响应示例
[
'self' => 'https://www.example.com/jira/rest/api/2/user/charlie',
'key' => 'charlie',
'name' => 'charlie',
'emailAddress' => 'charlie@atlassian.com',
'displayName' => 'Charlie of Atlassian',
];
create函数
创建用户。
$client->users()->create(body: [...]);
响应示例
[
'self' => 'https://www.example.com/jira/rest/api/2/user/charlie',
'key' => 'charlie',
'name' => 'charlie',
'emailAddress' => 'charlie@atlassian.com',
'displayName' => 'Charlie of Atlassian',
];
remove函数
删除用户及其引用(如项目角色关联、监视、历史记录)。
$client->users()->remove(query: [...]);
响应示例
null
get函数
返回用户。
$client->users()->get(query: [...]);
响应示例
[
'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred',
'name' => 'fred',
'emailAddress' => 'fred@example.com',
'avatarUrls' => [
'48x48' => 'https://www.example.com/jira/secure/useravatar?size=large&ownerId=fred',
'24x24' => 'https://www.example.com/jira/secure/useravatar?size=small&ownerId=fred',
'16x16' => 'https://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred',
'32x32' => 'https://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred',
],
'displayName' => 'Fred F. User',
'active' => true,
'timeZone' => 'Australia/Sydney',
'groups' => [
'size' => 3,
'items' => [
[
'name' => 'jira-user',
'self' => 'https://www.example.com/jira/rest/api/2/group?groupname=jira-user',
],
[
'name' => 'jira-admin',
'self' => 'https://www.example.com/jira/rest/api/2/group?groupname=jira-admin',
],
[
'name' => 'important',
'self' => 'https://www.example.com/jira/rest/api/2/group?groupname=important',
],
],
],
'applicationRoles' => [
'size' => 1,
'items' => [],
],
'expand' => 'groups,applicationRoles',
];
贡献
感谢您考虑为Jira PHP做出贡献!贡献指南可在CONTRIBUTING中找到。
安全漏洞
如果您发现任何与安全相关的问题,请通过电子邮件moath.alhajrii@gmail.com而不是使用问题跟踪器。
许可证
Jira PHP 是一个开源软件,许可协议为 MIT 许可证。
