/** * Update recipients for email-on-push service for a projectId. * * @param projectId The ID of the project containing the variable. * @param emailAddress The emailaddress of the recipent who is going to receive push notification. * @return * @throws IOException on gitlab api call error */ public boolean updateEmailsOnPush(Integer projectId, String emailAddress) throws IOException { GitlabServiceEmailOnPush emailOnPush = this.getEmailsOnPush(projectId); GitlabEmailonPushProperties properties = emailOnPush.getProperties(); String appendedRecipients = properties.getRecipients(); if (appendedRecipients != "") { if (appendedRecipients.contains(emailAddress)) return true; appendedRecipients = appendedRecipients + " " + emailAddress; } else appendedRecipients = emailAddress; Query query = new Query() .appendIf("active", true) .appendIf("recipients", appendedRecipients); String tailUrl = GitlabProject.URL + "/" + projectId + GitlabServiceEmailOnPush.URL + query.toString(); return retrieve().method(PUT).to(tailUrl, Boolean.class); }
/** * Update recipients for email-on-push service for a projectId. * * @param projectId The ID of the project containing the variable. * @param emailAddress The emailaddress of the recipent who is going to receive push notification. * @return * @throws IOException on gitlab api call error */ public boolean updateEmailsOnPush(Integer projectId, String emailAddress) throws IOException { GitlabServiceEmailOnPush emailOnPush = this.getEmailsOnPush(projectId); GitlabEmailonPushProperties properties = emailOnPush.getProperties(); String appendedRecipients = properties.getRecipients(); if (appendedRecipients != "") { if (appendedRecipients.contains(emailAddress)) return true; appendedRecipients = appendedRecipients + " " + emailAddress; } else appendedRecipients = emailAddress; Query query = new Query() .appendIf("active", true) .appendIf("recipients", appendedRecipients); String tailUrl = GitlabProject.URL + "/" + projectId + GitlabServiceEmailOnPush.URL + query.toString(); return retrieve().method(PUT).to(tailUrl, Boolean.class); }
/** * Update recipients for email-on-push service for a projectId. * * @param projectId The ID of the project containing the variable. * @param emailAddress The emailaddress of the recipent who is going to receive push notification. * @return * @throws IOException on gitlab api call error */ public boolean updateEmailsOnPush(Integer projectId, String emailAddress) throws IOException { GitlabServiceEmailOnPush emailOnPush = this.getEmailsOnPush(projectId); GitlabEmailonPushProperties properties = emailOnPush.getProperties(); String appendedRecipients = properties.getRecipients(); if (appendedRecipients != "") { if (appendedRecipients.contains(emailAddress)) return true; appendedRecipients = appendedRecipients + " " + emailAddress; } else appendedRecipients = emailAddress; Query query = new Query() .appendIf("active", true) .appendIf("recipients", appendedRecipients); String tailUrl = GitlabProject.URL + "/" + projectId + GitlabServiceEmailOnPush.URL + query.toString(); return retrieve().method(PUT).to(tailUrl, Boolean.class); }