View Javadoc

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 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   * @since 2.2.0
11   */
12  public interface UserProfile
13  {
14      /**
15       * Returns the username of the user associated with this profile information
16       *
17       * @return the username of the user associated with this profile information
18       */
19      String getUsername();
20  
21      /**
22       * Returns the full name of the user associated with this profile information
23       *
24       * @return the full name of the user associated with this profile information,
25       * or {@code null} if a full name was not provided or the application does not
26       * support the full name as profile data
27       */
28      String getFullName();
29  
30      /**
31       * Returns the email address of the user associated with this profile
32       *
33       * @return the email address of the user associated with this profile,
34       * or {@code null} if an email address was not provided or the application does
35       * not support email addresses as profile data
36       */
37      String getEmail();
38  
39      /**
40       * Returns a URI for the user's profile picture. The returned URI will point
41       * to an image of the user's profile picture no smaller than the requested size.
42       *
43       * The URI will either be relative to the application's base URI, or absolute if
44       * the profile picture is being served by an external server
45       *
46       * @param width the preferred width of the desired picture
47       * @param height the preferred height of the desired picture
48       * @return a URI pointing to an image of the user's profile picture, or {@code null}
49       * if a profile picture was not provided, the application does not support
50       * profile pictures as profile data, or the application was unable to provide an
51       * image larger than or equal to the requested size
52       */
53      URI getProfilePictureUri(int width, int height);
54  
55      /**
56       * Returns a URI for the user's profile picture. The returned URI will point
57       * to the largest possible unscaled image of the user's profile picture that the application
58       * can provide
59       *
60       * The URI will either be relative to the application's base URI, or absolute if
61       * the profile picture is being served by an external server
62       *
63       * @return a URI pointing to an image of the user's profile picture, or {@code null}
64       * if a profile picture was not provided or the application does not support
65       * profile pictures as profile data
66       */
67      URI getProfilePictureUri();
68  
69      /**
70       * Returns a URI for the user's profile page. The URI will be relative to
71       * the application's base URI
72       * 
73       * @return a relative URI pointing to the user's profile page, or {@code null} if
74       * the user does not have a profile page or the application does not support profile
75       * pages
76       */
77      URI getProfilePageUri();
78  }