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 #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 /** 18 * Returns the key of the user associated with this profile information. 19 * 20 * Note: the key is meant to uniquely identify a user, and be immutable for the duration of the life of the user. It 21 * is however not meant to be displayed: please use {@link #getUsername()} or {@link #getFullName()} for that purpose. 22 * 23 * @return the key of the user associated with this profile information. 24 * @since 2.10 25 * @see {@link UserKey} 26 */ 27 UserKey getUserKey(); 28 29 /** 30 * Returns the username of the user associated with this profile information. 31 * 32 * Note: depending on the product, the username might change during the life of the user. If you need a stable 33 * identifier, please use {@link #getUserKey()}. 34 * 35 * @return the username of the user associated with this profile information 36 * @see {@link #getUserKey()} 37 */ 38 String getUsername(); 39 40 /** 41 * Returns the full name of the user associated with this profile information 42 * 43 * @return the full name of the user associated with this profile information, 44 * or {@code null} if a full name was not provided or the application does not 45 * support the full name as profile data 46 */ 47 String getFullName(); 48 49 /** 50 * Returns the email address of the user associated with this profile 51 * 52 * @return the email address of the user associated with this profile, 53 * or {@code null} if an email address was not provided or the application does 54 * not support email addresses as profile data 55 */ 56 String getEmail(); 57 58 /** 59 * Returns a URI for the user's profile picture. The returned URI will point 60 * to an image of the user's profile picture no smaller than the requested size. 61 * 62 * The URI will either be relative to the application's base URI, or absolute if 63 * the profile picture is being served by an external server 64 * 65 * @param width the preferred width of the desired picture 66 * @param height the preferred height of the desired picture 67 * @return a URI pointing to an image of the user's profile picture, or {@code null} 68 * if a profile picture was not provided, the application does not support 69 * profile pictures as profile data, or the application was unable to provide an 70 * image larger than or equal to the requested size 71 */ 72 URI getProfilePictureUri(int width, int height); 73 74 /** 75 * Returns a URI for the user's profile picture. The returned URI will point 76 * to the largest possible unscaled image of the user's profile picture that the application 77 * can provide 78 * 79 * The URI will either be relative to the application's base URI, or absolute if 80 * the profile picture is being served by an external server 81 * 82 * @return a URI pointing to an image of the user's profile picture, or {@code null} 83 * if a profile picture was not provided or the application does not support 84 * profile pictures as profile data 85 */ 86 URI getProfilePictureUri(); 87 88 /** 89 * Returns a URI for the user's profile page. The URI will be relative to 90 * the application's base URI 91 * 92 * @return a relative URI pointing to the user's profile page, or {@code null} if 93 * the user does not have a profile page or the application does not support profile 94 * pages 95 */ 96 URI getProfilePageUri(); 97 98 99 }