Line data Source code
1 : // Copyright (C) 2014 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.extensions.api.accounts; 16 : 17 : import com.google.gerrit.extensions.client.DiffPreferencesInfo; 18 : import com.google.gerrit.extensions.client.EditPreferencesInfo; 19 : import com.google.gerrit.extensions.client.GeneralPreferencesInfo; 20 : import com.google.gerrit.extensions.client.ProjectWatchInfo; 21 : import com.google.gerrit.extensions.common.AccountDetailInfo; 22 : import com.google.gerrit.extensions.common.AccountExternalIdInfo; 23 : import com.google.gerrit.extensions.common.AccountInfo; 24 : import com.google.gerrit.extensions.common.AgreementInfo; 25 : import com.google.gerrit.extensions.common.EmailInfo; 26 : import com.google.gerrit.extensions.common.GpgKeyInfo; 27 : import com.google.gerrit.extensions.common.GroupInfo; 28 : import com.google.gerrit.extensions.common.SshKeyInfo; 29 : import com.google.gerrit.extensions.restapi.NotImplementedException; 30 : import com.google.gerrit.extensions.restapi.RestApiException; 31 : import java.util.List; 32 : import java.util.Map; 33 : 34 : public interface AccountApi { 35 : AccountInfo get() throws RestApiException; 36 : 37 : AccountDetailInfo detail() throws RestApiException; 38 : 39 : boolean getActive() throws RestApiException; 40 : 41 : void setActive(boolean active) throws RestApiException; 42 : 43 : String getAvatarUrl(int size) throws RestApiException; 44 : 45 : GeneralPreferencesInfo getPreferences() throws RestApiException; 46 : 47 : GeneralPreferencesInfo setPreferences(GeneralPreferencesInfo in) throws RestApiException; 48 : 49 : DiffPreferencesInfo getDiffPreferences() throws RestApiException; 50 : 51 : DiffPreferencesInfo setDiffPreferences(DiffPreferencesInfo in) throws RestApiException; 52 : 53 : EditPreferencesInfo getEditPreferences() throws RestApiException; 54 : 55 : EditPreferencesInfo setEditPreferences(EditPreferencesInfo in) throws RestApiException; 56 : 57 : List<ProjectWatchInfo> getWatchedProjects() throws RestApiException; 58 : 59 : List<ProjectWatchInfo> setWatchedProjects(List<ProjectWatchInfo> in) throws RestApiException; 60 : 61 : void deleteWatchedProjects(List<ProjectWatchInfo> in) throws RestApiException; 62 : 63 : void starChange(String changeId) throws RestApiException; 64 : 65 : void unstarChange(String changeId) throws RestApiException; 66 : 67 : List<GroupInfo> getGroups() throws RestApiException; 68 : 69 : List<EmailInfo> getEmails() throws RestApiException; 70 : 71 : void addEmail(EmailInput input) throws RestApiException; 72 : 73 : void deleteEmail(String email) throws RestApiException; 74 : 75 : EmailApi createEmail(EmailInput emailInput) throws RestApiException; 76 : 77 : EmailApi email(String email) throws RestApiException; 78 : 79 : void setStatus(String status) throws RestApiException; 80 : 81 : void setDisplayName(String displayName) throws RestApiException; 82 : 83 : List<SshKeyInfo> listSshKeys() throws RestApiException; 84 : 85 : SshKeyInfo addSshKey(String key) throws RestApiException; 86 : 87 : void deleteSshKey(int seq) throws RestApiException; 88 : 89 : Map<String, GpgKeyInfo> listGpgKeys() throws RestApiException; 90 : 91 : Map<String, GpgKeyInfo> putGpgKeys(List<String> add, List<String> remove) throws RestApiException; 92 : 93 : GpgKeyApi gpgKey(String id) throws RestApiException; 94 : 95 : List<AgreementInfo> listAgreements() throws RestApiException; 96 : 97 : void signAgreement(String agreementName) throws RestApiException; 98 : 99 : void index() throws RestApiException; 100 : 101 : List<AccountExternalIdInfo> getExternalIds() throws RestApiException; 102 : 103 : void deleteExternalIds(List<String> externalIds) throws RestApiException; 104 : 105 : List<DeletedDraftCommentInfo> deleteDraftComments(DeleteDraftCommentsInput input) 106 : throws RestApiException; 107 : 108 : void setName(String name) throws RestApiException; 109 : 110 : /** 111 : * Generate a new HTTP password. 112 : * 113 : * @return the generated password. 114 : */ 115 : String generateHttpPassword() throws RestApiException; 116 : 117 : /** 118 : * Set a new HTTP password. 119 : * 120 : * <p>May only be invoked by administrators. 121 : * 122 : * @param httpPassword the new password, {@code null} to remove the password. 123 : * @return the new password, {@code null} if the password was removed. 124 : */ 125 : String setHttpPassword(String httpPassword) throws RestApiException; 126 : 127 : /** 128 : * A default implementation which allows source compatibility when adding new methods to the 129 : * interface. 130 : */ 131 0 : class NotImplemented implements AccountApi { 132 : @Override 133 : public AccountInfo get() throws RestApiException { 134 0 : throw new NotImplementedException(); 135 : } 136 : 137 : @Override 138 : public AccountDetailInfo detail() throws RestApiException { 139 0 : throw new NotImplementedException(); 140 : } 141 : 142 : @Override 143 : public boolean getActive() throws RestApiException { 144 0 : throw new NotImplementedException(); 145 : } 146 : 147 : @Override 148 : public void setActive(boolean active) throws RestApiException { 149 0 : throw new NotImplementedException(); 150 : } 151 : 152 : @Override 153 : public String getAvatarUrl(int size) throws RestApiException { 154 0 : throw new NotImplementedException(); 155 : } 156 : 157 : @Override 158 : public GeneralPreferencesInfo getPreferences() throws RestApiException { 159 0 : throw new NotImplementedException(); 160 : } 161 : 162 : @Override 163 : public GeneralPreferencesInfo setPreferences(GeneralPreferencesInfo in) 164 : throws RestApiException { 165 0 : throw new NotImplementedException(); 166 : } 167 : 168 : @Override 169 : public DiffPreferencesInfo getDiffPreferences() throws RestApiException { 170 0 : throw new NotImplementedException(); 171 : } 172 : 173 : @Override 174 : public DiffPreferencesInfo setDiffPreferences(DiffPreferencesInfo in) throws RestApiException { 175 0 : throw new NotImplementedException(); 176 : } 177 : 178 : @Override 179 : public EditPreferencesInfo getEditPreferences() throws RestApiException { 180 0 : throw new NotImplementedException(); 181 : } 182 : 183 : @Override 184 : public EditPreferencesInfo setEditPreferences(EditPreferencesInfo in) throws RestApiException { 185 0 : throw new NotImplementedException(); 186 : } 187 : 188 : @Override 189 : public List<ProjectWatchInfo> getWatchedProjects() throws RestApiException { 190 0 : throw new NotImplementedException(); 191 : } 192 : 193 : @Override 194 : public List<ProjectWatchInfo> setWatchedProjects(List<ProjectWatchInfo> in) 195 : throws RestApiException { 196 0 : throw new NotImplementedException(); 197 : } 198 : 199 : @Override 200 : public void deleteWatchedProjects(List<ProjectWatchInfo> in) throws RestApiException { 201 0 : throw new NotImplementedException(); 202 : } 203 : 204 : @Override 205 : public void starChange(String changeId) throws RestApiException { 206 0 : throw new NotImplementedException(); 207 : } 208 : 209 : @Override 210 : public void unstarChange(String changeId) throws RestApiException { 211 0 : throw new NotImplementedException(); 212 : } 213 : 214 : @Override 215 : public List<GroupInfo> getGroups() throws RestApiException { 216 0 : throw new NotImplementedException(); 217 : } 218 : 219 : @Override 220 : public List<EmailInfo> getEmails() throws RestApiException { 221 0 : throw new NotImplementedException(); 222 : } 223 : 224 : @Override 225 : public void addEmail(EmailInput input) throws RestApiException { 226 0 : throw new NotImplementedException(); 227 : } 228 : 229 : @Override 230 : public void deleteEmail(String email) throws RestApiException { 231 0 : throw new NotImplementedException(); 232 : } 233 : 234 : @Override 235 : public EmailApi createEmail(EmailInput input) throws RestApiException { 236 0 : throw new NotImplementedException(); 237 : } 238 : 239 : @Override 240 : public EmailApi email(String email) throws RestApiException { 241 0 : throw new NotImplementedException(); 242 : } 243 : 244 : @Override 245 : public void setStatus(String status) throws RestApiException { 246 0 : throw new NotImplementedException(); 247 : } 248 : 249 : @Override 250 : public void setDisplayName(String displayName) throws RestApiException { 251 0 : throw new NotImplementedException(); 252 : } 253 : 254 : @Override 255 : public List<SshKeyInfo> listSshKeys() throws RestApiException { 256 0 : throw new NotImplementedException(); 257 : } 258 : 259 : @Override 260 : public SshKeyInfo addSshKey(String key) throws RestApiException { 261 0 : throw new NotImplementedException(); 262 : } 263 : 264 : @Override 265 : public void deleteSshKey(int seq) throws RestApiException { 266 0 : throw new NotImplementedException(); 267 : } 268 : 269 : @Override 270 : public Map<String, GpgKeyInfo> putGpgKeys(List<String> add, List<String> remove) 271 : throws RestApiException { 272 0 : throw new NotImplementedException(); 273 : } 274 : 275 : @Override 276 : public GpgKeyApi gpgKey(String id) throws RestApiException { 277 0 : throw new NotImplementedException(); 278 : } 279 : 280 : @Override 281 : public Map<String, GpgKeyInfo> listGpgKeys() throws RestApiException { 282 0 : throw new NotImplementedException(); 283 : } 284 : 285 : @Override 286 : public List<AgreementInfo> listAgreements() throws RestApiException { 287 0 : throw new NotImplementedException(); 288 : } 289 : 290 : @Override 291 : public void signAgreement(String agreementName) throws RestApiException { 292 0 : throw new NotImplementedException(); 293 : } 294 : 295 : @Override 296 : public void index() throws RestApiException { 297 0 : throw new NotImplementedException(); 298 : } 299 : 300 : @Override 301 : public List<AccountExternalIdInfo> getExternalIds() throws RestApiException { 302 0 : throw new NotImplementedException(); 303 : } 304 : 305 : @Override 306 : public void deleteExternalIds(List<String> externalIds) throws RestApiException { 307 0 : throw new NotImplementedException(); 308 : } 309 : 310 : @Override 311 : public List<DeletedDraftCommentInfo> deleteDraftComments(DeleteDraftCommentsInput input) 312 : throws RestApiException { 313 0 : throw new NotImplementedException(); 314 : } 315 : 316 : @Override 317 : public void setName(String name) throws RestApiException { 318 0 : throw new NotImplementedException(); 319 : } 320 : 321 : @Override 322 : public String generateHttpPassword() throws RestApiException { 323 0 : throw new NotImplementedException(); 324 : } 325 : 326 : @Override 327 : public String setHttpPassword(String httpPassword) throws RestApiException { 328 0 : throw new NotImplementedException(); 329 : } 330 : } 331 : }