Skip to content

Commit 7a3ac29

Browse files
committed
providing new method to enable patch clients credential endpoint
1 parent cb4d0e0 commit 7a3ac29

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

src/main/java/com/auth0/client/mgmt/ClientsEntity.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,32 @@ public Request<Void> deleteCredential(String clientId, String credentialId) {
265265
.toString();
266266
return new VoidRequest(client, tokenProvider, url, HttpMethod.DELETE);
267267
}
268+
269+
/**
270+
* Update an existing client credential. A token with scope update:clients is needed. If you also need to update the client_secret and encryption_key attributes the token must have update:client_keys scope.
271+
* See https://auth0.com/docs/api/management/v2/clients/patch-credentials-by-credential-id
272+
*
273+
* @param clientId the application's client id.
274+
* @param credentialId the ID of the credential.
275+
* @param credential the credential to update.
276+
* @return a Request to execute.
277+
*/
278+
public Request<Credential> updateCredential(String clientId, String credentialId, Credential credential) {
279+
Asserts.assertNotNull(clientId, "client id");
280+
Asserts.assertNotNull(credentialId, "credential id");
281+
Asserts.assertNotNull(credential, "credential");
282+
283+
String url = baseUrl
284+
.newBuilder()
285+
.addPathSegments("api/v2/clients")
286+
.addPathSegment(clientId)
287+
.addPathSegment("credentials")
288+
.addPathSegment(credentialId)
289+
.build()
290+
.toString();
291+
BaseRequest<Credential> request = new BaseRequest<>(this.client, tokenProvider, url, HttpMethod.PATCH, new TypeReference<Credential>() {
292+
});
293+
request.setBody(credential);
294+
return request;
295+
}
268296
}

0 commit comments

Comments
 (0)