1 package com.atlassian.sal.api.user;
2
3 import java.net.URI;
4
5 /**
6 * Interface encapsulating a user's profile information. Any of the properties except
7 * for the username and the userKey may be {@code null}, which indicates either that the underlying application
8 * does not support that profile data, or that the user did not provide that profile data.
9 *
10 * Note: implementors of this interface should override the {@link java.lang.Object#equals(Object)} method such that two users with the
11 * same userKey are considered equal.
12 *
13 * @since 2.2.0
14 */
15 public interface UserProfile {
16 /**
17 * Returns the key of the user associated with this profile information.
18 *
19 * Note: the key is meant to uniquely identify a user, and be immutable for the duration of the life of the user. It
20 * is however not meant to be displayed: please use {@link #getUsername()} or {@link #getFullName()} for that purpose.
21 *
22 * @return the key of the user associated with this profile information.
23 * @see UserKey
24 * @since 2.10
25 */
26 UserKey getUserKey();
27
28 /**
29 * Returns the username of the user associated with this profile information.
30 *
31 * Note: depending on the product, the username might change during the life of the user. If you need a stable
32 * identifier, please use {@link #getUserKey()}.
33 *
34 * @return the username of the user associated with this profile information
35 * @see #getUserKey()
36 */
37 String getUsername();
38
39 /**
40 * Returns the full name of the user associated with this profile information
41 *
42 * @return the full name of the user associated with this profile information,
43 * or {@code null} if a full name was not provided or the application does not
44 * support the full name as profile data
45 */
46 String getFullName();
47
48 /**
49 * Returns the email address of the user associated with this profile
50 *
51 * @return the email address of the user associated with this profile,
52 * or {@code null} if an email address was not provided or the application does
53 * not support email addresses as profile data
54 */
55 String getEmail();
56
57 /**
58 * Returns a URI for the user's profile picture. The returned URI will point
59 * to an image of the user's profile picture no smaller than the requested size.
60 *
61 * The URI will either be relative to the application's base URI, or absolute if
62 * the profile picture is being served by an external server
63 *
64 * @param width the preferred width of the desired picture
65 * @param height the preferred height of the desired picture
66 * @return a URI pointing to an image of the user's profile picture, or {@code null}
67 * if a profile picture was not provided, the application does not support
68 * profile pictures as profile data, or the application was unable to provide an
69 * image larger than or equal to the requested size
70 */
71 URI getProfilePictureUri(int width, int height);
72
73 /**
74 * Returns a URI for the user's profile picture. The returned URI will point
75 * to the largest possible unscaled image of the user's profile picture that the application
76 * can provide
77 *
78 * The URI will either be relative to the application's base URI, or absolute if
79 * the profile picture is being served by an external server
80 *
81 * @return a URI pointing to an image of the user's profile picture, or {@code null}
82 * if a profile picture was not provided or the application does not support
83 * profile pictures as profile data
84 */
85 URI getProfilePictureUri();
86
87 /**
88 * Returns a URI for the user's profile page. The URI will be relative to
89 * the application's base URI
90 *
91 * @return a relative URI pointing to the user's profile page, or {@code null} if
92 * the user does not have a profile page or the application does not support profile
93 * pages
94 */
95 URI getProfilePageUri();
96
97
98 }