Add REST API endpoints for user's contribution agreements

Add two new REST API endpoints to list the user's contribution
agreements, and to enter a contribution agreement.

The list of contribution agreements differs from the existing RPC
endpoint in that it only returns a list of the agreements that the
user has entered; it does not include a list of existing agreements.

Bug: Issue 4316
Change-Id: I7d988aa59c06380767d888e22f6e0eaad62d8b34
This commit is contained in:
David Pursehouse
2016-05-02 22:30:59 +09:00
committed by David Pursehouse
parent 9f7e37cbf7
commit 4578763c7a
10 changed files with 526 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ 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.AccountInfo;
import com.google.gerrit.extensions.common.AgreementInfo;
import com.google.gerrit.extensions.common.ChangeInfo;
import com.google.gerrit.extensions.common.GpgKeyInfo;
import com.google.gerrit.extensions.common.SshKeyInfo;
@@ -70,6 +71,9 @@ public interface AccountApi {
throws RestApiException;
GpgKeyApi gpgKey(String id) throws RestApiException;
List<AgreementInfo> listAgreements() throws RestApiException;
void signAgreement(String agreementName) throws RestApiException;
/**
* A default implementation which allows source compatibility
* when adding new methods to the interface.
@@ -197,5 +201,15 @@ public interface AccountApi {
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();
}
}
}

View File

@@ -0,0 +1,21 @@
// Copyright (C) 2016 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.common;
public class AgreementInfo {
public String name;
public String description;
public String url;
}

View File

@@ -0,0 +1,24 @@
// Copyright (C) 2016 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.common;
import com.google.gerrit.extensions.restapi.DefaultInput;
/** This entity contains information for registering a new contributor agreement. */
public class AgreementInput {
/* The agreement name. */
@DefaultInput
public String name;
}