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

tylernathanreed / jira-client-php / 13634794100

03 Mar 2025 03:19PM UTC coverage: 2.067% (-0.1%) from 2.21%
13634794100

push

github

web-flow
~ Try coveralls action

140 of 6773 relevant lines covered (2.07%)

0.03 hits per line

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

0.0
/src/Operations/ProjectAvatars.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 ProjectAvatars
10
{
11
    /**
12
     * Sets the avatar displayed for a project
13
     * 
14
     * Use "Load project avatar" to store avatars against the project, before using this operation to set the displayed avatar
15
     * 
16
     * **"Permissions" required:** *Administer projects* "project permission".
17
     * 
18
     * @link https://confluence.atlassian.com/x/yodKLg
19
     * 
20
     * @param string $projectIdOrKey The ID or (case-sensitive) key of the project.
21
     */
22
    public function updateProjectAvatar(
×
23
        Schema\Avatar $request,
24
        string $projectIdOrKey,
25
    ): true {
26
        return $this->call(
×
27
            uri: '/rest/api/3/project/{projectIdOrKey}/avatar',
×
28
            method: 'put',
×
29
            body: $request,
×
30
            path: compact('projectIdOrKey'),
×
31
            success: 204,
×
32
            schema: true,
×
33
        );
×
34
    }
35

36
    /**
37
     * Deletes a custom avatar from a project.
38
     * Note that system avatars cannot be deleted
39
     * 
40
     * **"Permissions" required:** *Administer projects* "project permission".
41
     * 
42
     * @link https://confluence.atlassian.com/x/yodKLg
43
     * 
44
     * @param string $projectIdOrKey The project ID or (case-sensitive) key.
45
     * @param int $id The ID of the avatar.
46
     */
47
    public function deleteProjectAvatar(
×
48
        string $projectIdOrKey,
49
        int $id,
50
    ): true {
51
        return $this->call(
×
52
            uri: '/rest/api/3/project/{projectIdOrKey}/avatar/{id}',
×
53
            method: 'delete',
×
54
            path: compact('projectIdOrKey', 'id'),
×
55
            success: 204,
×
56
            schema: true,
×
57
        );
×
58
    }
59

60
    /**
61
     * Loads an avatar for a project
62
     * 
63
     * Specify the avatar's local file location in the body of the request.
64
     * Also, include the following headers:
65
     * 
66
     *  - `X-Atlassian-Token: no-check` To prevent XSRF protection blocking the request, for more information see "Special Headers"
67
     *  - `Content-Type: image/image type` Valid image types are JPEG, GIF, or PNG
68
     * 
69
     * For example:  
70
     * `curl --request POST `
71
     * 
72
     * `--user email@example.com:<api_token> `
73
     * 
74
     * `--header 'X-Atlassian-Token: no-check' `
75
     * 
76
     * `--header 'Content-Type: image/< image_type>' `
77
     * 
78
     * `--data-binary "<@/path/to/file/with/your/avatar>" `
79
     * 
80
     * `--url 'https://your-domain.atlassian.net/rest/api/3/project/{projectIdOrKey}/avatar2'`
81
     * 
82
     * The avatar is cropped to a square.
83
     * If no crop parameters are specified, the square originates at the top left of the image.
84
     * The length of the square's sides is set to the smaller of the height or width of the image
85
     * 
86
     * The cropped image is then used to create avatars of 16x16, 24x24, 32x32, and 48x48 in size
87
     * 
88
     * After creating the avatar use "Set project avatar" to set it as the project's displayed avatar
89
     * 
90
     * **"Permissions" required:** *Administer projects* "project permission".
91
     * 
92
     * @link https://confluence.atlassian.com/x/yodKLg
93
     * 
94
     * @param string $projectIdOrKey The ID or (case-sensitive) key of the project.
95
     * @param int $x The X coordinate of the top-left corner of the crop region.
96
     * @param int $y The Y coordinate of the top-left corner of the crop region.
97
     * @param int $size The length of each side of the crop region.
98
     */
99
    public function createProjectAvatar(
×
100
        string $projectIdOrKey,
101
        ?int $x = 0,
102
        ?int $y = 0,
103
        ?int $size = 0,
104
    ): Schema\Avatar {
105
        return $this->call(
×
106
            uri: '/rest/api/3/project/{projectIdOrKey}/avatar2',
×
107
            method: 'post',
×
108
            query: compact('x', 'y', 'size'),
×
109
            path: compact('projectIdOrKey'),
×
110
            success: 201,
×
111
            schema: Schema\Avatar::class,
×
112
        );
×
113
    }
114

115
    /**
116
     * Returns all project avatars, grouped by system and custom avatars
117
     * 
118
     * This operation can be accessed anonymously
119
     * 
120
     * **"Permissions" required:** *Browse projects* "project permission" for the project.
121
     * 
122
     * @link https://confluence.atlassian.com/x/yodKLg
123
     * 
124
     * @param string $projectIdOrKey The ID or (case-sensitive) key of the project.
125
     */
126
    public function getAllProjectAvatars(
×
127
        string $projectIdOrKey,
128
    ): Schema\ProjectAvatars {
129
        return $this->call(
×
130
            uri: '/rest/api/3/project/{projectIdOrKey}/avatars',
×
131
            method: 'get',
×
132
            path: compact('projectIdOrKey'),
×
133
            success: 200,
×
134
            schema: Schema\ProjectAvatars::class,
×
135
        );
×
136
    }
137
}
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