| // Copyright (C) 2014 The Android Open Source Project |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| package com.google.gerrit.extensions.api.accounts; |
| |
| import com.google.errorprone.annotations.CanIgnoreReturnValue; |
| import com.google.gerrit.extensions.client.DiffPreferencesInfo; |
| import com.google.gerrit.extensions.client.EditPreferencesInfo; |
| import com.google.gerrit.extensions.client.GeneralPreferencesInfo; |
| import com.google.gerrit.extensions.client.ProjectWatchInfo; |
| import com.google.gerrit.extensions.common.AccountDetailInfo; |
| import com.google.gerrit.extensions.common.AccountExternalIdInfo; |
| import com.google.gerrit.extensions.common.AccountInfo; |
| import com.google.gerrit.extensions.common.AgreementInfo; |
| import com.google.gerrit.extensions.common.EmailInfo; |
| import com.google.gerrit.extensions.common.GpgKeyInfo; |
| import com.google.gerrit.extensions.common.GroupInfo; |
| import com.google.gerrit.extensions.common.SshKeyInfo; |
| import com.google.gerrit.extensions.restapi.NotImplementedException; |
| import com.google.gerrit.extensions.restapi.RestApiException; |
| import java.util.List; |
| import java.util.Map; |
| |
| public interface AccountApi { |
| AccountInfo get() throws RestApiException; |
| |
| AccountDetailInfo detail() throws RestApiException; |
| |
| boolean getActive() throws RestApiException; |
| |
| void setActive(boolean active) throws RestApiException; |
| |
| String getAvatarUrl(int size) throws RestApiException; |
| |
| GeneralPreferencesInfo getPreferences() throws RestApiException; |
| |
| @CanIgnoreReturnValue |
| GeneralPreferencesInfo setPreferences(GeneralPreferencesInfo in) throws RestApiException; |
| |
| DiffPreferencesInfo getDiffPreferences() throws RestApiException; |
| |
| @CanIgnoreReturnValue |
| DiffPreferencesInfo setDiffPreferences(DiffPreferencesInfo in) throws RestApiException; |
| |
| EditPreferencesInfo getEditPreferences() throws RestApiException; |
| |
| @CanIgnoreReturnValue |
| EditPreferencesInfo setEditPreferences(EditPreferencesInfo in) throws RestApiException; |
| |
| List<ProjectWatchInfo> getWatchedProjects() throws RestApiException; |
| |
| @CanIgnoreReturnValue |
| List<ProjectWatchInfo> setWatchedProjects(List<ProjectWatchInfo> in) throws RestApiException; |
| |
| void deleteWatchedProjects(List<ProjectWatchInfo> in) throws RestApiException; |
| |
| void starChange(String changeId) throws RestApiException; |
| |
| void unstarChange(String changeId) throws RestApiException; |
| |
| List<GroupInfo> getGroups() throws RestApiException; |
| |
| List<EmailInfo> getEmails() throws RestApiException; |
| |
| void addEmail(EmailInput input) throws RestApiException; |
| |
| void deleteEmail(String email) throws RestApiException; |
| |
| @CanIgnoreReturnValue |
| EmailApi createEmail(EmailInput emailInput) throws RestApiException; |
| |
| EmailApi email(String email) throws RestApiException; |
| |
| void setStatus(String status) throws RestApiException; |
| |
| void setDisplayName(String displayName) throws RestApiException; |
| |
| List<SshKeyInfo> listSshKeys() throws RestApiException; |
| |
| @CanIgnoreReturnValue |
| SshKeyInfo addSshKey(String key) throws RestApiException; |
| |
| void deleteSshKey(int seq) throws RestApiException; |
| |
| Map<String, GpgKeyInfo> listGpgKeys() throws RestApiException; |
| |
| @CanIgnoreReturnValue |
| Map<String, GpgKeyInfo> putGpgKeys(List<String> add, List<String> remove) throws RestApiException; |
| |
| GpgKeyApi gpgKey(String id) throws RestApiException; |
| |
| List<AgreementInfo> listAgreements() throws RestApiException; |
| |
| void signAgreement(String agreementName) throws RestApiException; |
| |
| void index() throws RestApiException; |
| |
| List<AccountExternalIdInfo> getExternalIds() throws RestApiException; |
| |
| void deleteExternalIds(List<String> externalIds) throws RestApiException; |
| |
| @CanIgnoreReturnValue |
| List<DeletedDraftCommentInfo> deleteDraftComments(DeleteDraftCommentsInput input) |
| throws RestApiException; |
| |
| void setName(String name) throws RestApiException; |
| |
| /** |
| * Generate a new HTTP password. |
| * |
| * @return the generated password. |
| */ |
| String generateHttpPassword() throws RestApiException; |
| |
| /** |
| * Set a new HTTP password. |
| * |
| * <p>May only be invoked by administrators. |
| * |
| * @param httpPassword the new password, {@code null} to remove the password. |
| * @return the new password, {@code null} if the password was removed. |
| */ |
| @CanIgnoreReturnValue |
| String setHttpPassword(String httpPassword) throws RestApiException; |
| |
| void delete() throws RestApiException; |
| |
| /** |
| * A default implementation which allows source compatibility when adding new methods to the |
| * interface. |
| */ |
| class NotImplemented implements AccountApi { |
| @Override |
| public AccountInfo get() throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public AccountDetailInfo detail() throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public boolean getActive() throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public void setActive(boolean active) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public String getAvatarUrl(int size) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public GeneralPreferencesInfo getPreferences() throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public GeneralPreferencesInfo setPreferences(GeneralPreferencesInfo in) |
| throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public DiffPreferencesInfo getDiffPreferences() throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public DiffPreferencesInfo setDiffPreferences(DiffPreferencesInfo in) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public EditPreferencesInfo getEditPreferences() throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public EditPreferencesInfo setEditPreferences(EditPreferencesInfo in) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public List<ProjectWatchInfo> getWatchedProjects() throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public List<ProjectWatchInfo> setWatchedProjects(List<ProjectWatchInfo> in) |
| throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public void deleteWatchedProjects(List<ProjectWatchInfo> in) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public void starChange(String changeId) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public void unstarChange(String changeId) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public List<GroupInfo> getGroups() throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public List<EmailInfo> getEmails() throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public void addEmail(EmailInput input) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public void deleteEmail(String email) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public EmailApi createEmail(EmailInput input) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public EmailApi email(String email) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public void setStatus(String status) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public void setDisplayName(String displayName) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public List<SshKeyInfo> listSshKeys() throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public SshKeyInfo addSshKey(String key) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public void deleteSshKey(int seq) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public Map<String, GpgKeyInfo> putGpgKeys(List<String> add, List<String> remove) |
| throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public GpgKeyApi gpgKey(String id) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public Map<String, GpgKeyInfo> listGpgKeys() throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public List<AgreementInfo> listAgreements() throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public void signAgreement(String agreementName) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public void index() throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public List<AccountExternalIdInfo> getExternalIds() throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public void deleteExternalIds(List<String> externalIds) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public List<DeletedDraftCommentInfo> deleteDraftComments(DeleteDraftCommentsInput input) |
| throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public void setName(String name) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public String generateHttpPassword() throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public String setHttpPassword(String httpPassword) throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| |
| @Override |
| public void delete() throws RestApiException { |
| throw new NotImplementedException(); |
| } |
| } |
| } |