public static void main(String[] args) { try { // Get authenticated user APIUser me = CLIENT.me(); // List available data printUser(me); // Updating user data me.setAddress("Address"); me.setCity("City"); me.setCode("1234567890"); me.setCountry("Finland"); me.setEmail("admin@localhost"); me.setName("My name is ..."); me.setOrganization("BitBar"); me.setPhone("0987654321"); me.setState("Some state"); me.setVatID("FR1234890"); me.update(); // List data again printUser(me); } catch (APIException apie) { System.err.println(apie.getMessage()); } }
public static void main(String[] args) { try { // Get authenticated user APIUser me = CLIENT.me(); // Clean notification emails, if exist for (APINotificationEmail notificationEmail : me.getNotificationEmails().getEntity().getData()) { System.out.println( String.format("Deleting notification email %s", notificationEmail.getEmail())); notificationEmail.delete(); } System.out.println("Now add some notification emails"); // Create notification email, for specified email, notified always me.createNotificationEmail("email@localhost", APINotificationEmail.Type.ALWAYS); // Create notification email, for specified email, notified on test run failures me.createNotificationEmail("different.email@localhost", APINotificationEmail.Type.ON_FAILURE); // Then you can get list of created notification emails APIList<APINotificationEmail> notificationEmailsList = me.getNotificationEmails().getEntity(); System.out.println("Notification emails are:"); for (APINotificationEmail notificationEmail : notificationEmailsList.getData()) { System.out.println( String.format( "%s, type: %s", notificationEmail.getEmail(), notificationEmail.getType())); } // You can create notification email for project only APIProject project = me.createProject(APIProject.Type.ANDROID); project.createNotificationEmail("user@localhost", APINotificationEmail.Type.ON_FAILURE); // And get it for (APINotificationEmail notificationEmail : project.getNotificationEmails().getEntity().getData()) { System.out.println( String.format( "%s, type: %s", notificationEmail.getEmail(), notificationEmail.getType())); } } catch (APIException apie) { System.err.println(apie.getMessage()); } }