Skip to content

Commit df728c2

Browse files
committed
refactor: rename getEndUserByEmail to lookupEndUser across all SDKs
Align SDK wrapper methods with the OpenAPI operationId (lookupEndUser). Renames method, types, analytics actions, internal API calls, and changelog entries in TypeScript, Python, and Java.
1 parent ad6a152 commit df728c2

28 files changed

Lines changed: 2040 additions & 342 deletions

go/openapi/client.gen.go

Lines changed: 336 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Added `getEndUserByEmail` to `EndUserClient` for looking up end users by email across all email-based authentication methods.
1+
Added `lookupEndUser` to `EndUserClient` for looking up end users by email across all email-based authentication methods.

java/src/main/java/com/coinbase/cdp/client/enduser/EndUserClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,16 @@ public EndUser getEndUser(String userId) throws ApiException {
181181
}
182182

183183
/**
184-
* Gets an end user by email address.
184+
* Looks up an end user by email address.
185185
*
186186
* <p>Searches across all email-based authentication methods (email, Google, Apple, GitHub).
187187
*
188188
* @param email the email address to search for
189189
* @return the end user
190190
* @throws ApiException if the API call fails
191191
*/
192-
public EndUser getEndUserByEmail(String email) throws ApiException {
193-
return endUserAccountsApi.getEndUserByEmail(email);
192+
public EndUser lookupEndUser(String email) throws ApiException {
193+
return endUserAccountsApi.lookupEndUser(email);
194194
}
195195

196196
/**

java/src/main/java/com/coinbase/cdp/openapi/api/EmbeddedWalletsApi.java

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.coinbase.cdp.openapi.model.CreateEvmEip7702DelegationWithEndUserAccountRequest;
2222
import com.coinbase.cdp.openapi.model.Error;
2323
import com.coinbase.cdp.openapi.model.EvmUserOperation;
24+
import com.coinbase.cdp.openapi.model.GetDelegationForEndUser200Response;
2425
import com.coinbase.cdp.openapi.model.RevokeDelegationForEndUserRequest;
2526
import com.coinbase.cdp.openapi.model.SendEvmAssetWithEndUserAccount200Response;
2627
import com.coinbase.cdp.openapi.model.SendEvmAssetWithEndUserAccountRequest;
@@ -231,6 +232,107 @@ private HttpRequest.Builder createEvmEip7702DelegationWithEndUserAccountRequestB
231232
return localVarRequestBuilder;
232233
}
233234

235+
/**
236+
* Get delegation for end user
237+
* Returns the active delegation for the specified end user, if one exists. This operation can be performed by the end user themselves or by a developer using their API key.
238+
* @param userId The ID of the end user. (required)
239+
* @param projectID The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider). (optional)
240+
* @return GetDelegationForEndUser200Response
241+
* @throws ApiException if fails to make API call
242+
*/
243+
public GetDelegationForEndUser200Response getDelegationForEndUser(String userId, String projectID) throws ApiException {
244+
ApiResponse<GetDelegationForEndUser200Response> localVarResponse = getDelegationForEndUserWithHttpInfo(userId, projectID);
245+
return localVarResponse.getData();
246+
}
247+
248+
/**
249+
* Get delegation for end user
250+
* Returns the active delegation for the specified end user, if one exists. This operation can be performed by the end user themselves or by a developer using their API key.
251+
* @param userId The ID of the end user. (required)
252+
* @param projectID The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider). (optional)
253+
* @return ApiResponse&lt;GetDelegationForEndUser200Response&gt;
254+
* @throws ApiException if fails to make API call
255+
*/
256+
public ApiResponse<GetDelegationForEndUser200Response> getDelegationForEndUserWithHttpInfo(String userId, String projectID) throws ApiException {
257+
HttpRequest.Builder localVarRequestBuilder = getDelegationForEndUserRequestBuilder(userId, projectID);
258+
try {
259+
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
260+
localVarRequestBuilder.build(),
261+
HttpResponse.BodyHandlers.ofInputStream());
262+
if (memberVarResponseInterceptor != null) {
263+
memberVarResponseInterceptor.accept(localVarResponse);
264+
}
265+
try {
266+
if (localVarResponse.statusCode()/ 100 != 2) {
267+
throw getApiException("getDelegationForEndUser", localVarResponse);
268+
}
269+
if (localVarResponse.body() == null) {
270+
return new ApiResponse<GetDelegationForEndUser200Response>(
271+
localVarResponse.statusCode(),
272+
localVarResponse.headers().map(),
273+
null
274+
);
275+
}
276+
277+
String responseBody = new String(localVarResponse.body().readAllBytes());
278+
localVarResponse.body().close();
279+
280+
return new ApiResponse<GetDelegationForEndUser200Response>(
281+
localVarResponse.statusCode(),
282+
localVarResponse.headers().map(),
283+
responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference<GetDelegationForEndUser200Response>() {})
284+
);
285+
} finally {
286+
}
287+
} catch (IOException e) {
288+
throw new ApiException(e);
289+
}
290+
catch (InterruptedException e) {
291+
Thread.currentThread().interrupt();
292+
throw new ApiException(e);
293+
}
294+
}
295+
296+
private HttpRequest.Builder getDelegationForEndUserRequestBuilder(String userId, String projectID) throws ApiException {
297+
// verify the required parameter 'userId' is set
298+
if (userId == null) {
299+
throw new ApiException(400, "Missing the required parameter 'userId' when calling getDelegationForEndUser");
300+
}
301+
302+
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
303+
304+
String localVarPath = "/v2/embedded-wallet-api/end-users/{userId}/delegation"
305+
.replace("{userId}", ApiClient.urlEncode(userId.toString()));
306+
307+
List<Pair> localVarQueryParams = new ArrayList<>();
308+
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
309+
String localVarQueryParameterBaseName;
310+
localVarQueryParameterBaseName = "projectID";
311+
localVarQueryParams.addAll(ApiClient.parameterToPairs("projectID", projectID));
312+
313+
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
314+
StringJoiner queryJoiner = new StringJoiner("&");
315+
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
316+
if (localVarQueryStringJoiner.length() != 0) {
317+
queryJoiner.add(localVarQueryStringJoiner.toString());
318+
}
319+
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
320+
} else {
321+
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
322+
}
323+
324+
localVarRequestBuilder.header("Accept", "application/json");
325+
326+
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
327+
if (memberVarReadTimeout != null) {
328+
localVarRequestBuilder.timeout(memberVarReadTimeout);
329+
}
330+
if (memberVarInterceptor != null) {
331+
memberVarInterceptor.accept(localVarRequestBuilder);
332+
}
333+
return localVarRequestBuilder;
334+
}
335+
234336
/**
235337
* Revoke delegation for end user
236338
* Revokes all active delegations for the specified end user. This operation can be performed by the end user themselves or by a developer using their API key.

0 commit comments

Comments
 (0)