The org.opencode4workspace.endpoints.PhotoPostEndpoint is used to post a new profile photo and retrieve a PhotoResponse object coresponding to a successful posting.

The PhotoPostEndpoint is instantiated like the other endpoints, by passing in the WWClient for the request. The JPEG image file is posted using the postPhoto(File file) method. The file should be a .jpg less than 300Kb (this is specified as a restriction of the "/photos" REST endpoint in the Watson Workspace documentation). Alternatively the WWClient.postPhoto(File file) helper method is available for easier use.

The "/photos" endpoint can only be called from a user-authenticated WWClient. They cannot be called from an application-authenticated WWClient.

If the posting is successful, a PhotoResponse object is returned comprising the String id of the photo, a boolean for the successful posting, and a String URL to the photo file.

Examples

File photo = new File("C:/temp/PaulWithers.jpg");
PhotoResponse response = client.postPhoto(photo);
assert(response.isSuccess());
PhotoPostEndpoint ep = new PhotoPostEndpoint(client);
File photo = new File("C:/temp/PaulWithers.jpg");
PhotoResponse response = ep.postPhoto(photo);
assert(response.isSuccess());