Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding addition methods to identity service client #526

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

truhacevkir
Copy link
Contributor

Adding methods for fetching customer by id and listing all customers to IdentityServiceClient, so there is noe need to implement "complex configured" http client each time we need to make authenticated request to identity-service.

@@ -2,11 +2,17 @@

import com.fasterxml.jackson.annotation.JsonProperty;
import java.net.URI;
import java.util.List;
import java.util.UUID;
import no.unit.nva.commons.json.JsonSerializable;

public record GetCustomerResponse(@JsonProperty("id") URI id, UUID identifier, String name, String displayName,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename this class? "GetCustomerResponse" has unfortunate connotations. CustomerDto or Customer?

.uri(customerId);
return attempt(getHttpResponseCallable(request))
.map(this::validateResponse)
.map(r -> mapResponse(GetCustomerResponse.class, r))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r?

Comment on lines +100 to +102
var request = HttpRequest.newBuilder()
.GET()
.uri(customerId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be extracted, and add relevant headers (e.g. Accept, possibly Accept-Encoding) since there are some defaults that Java inserts (actually, check these by adding a breakpoint and get back to me)

Comment on lines +110 to +112
var request = HttpRequest.newBuilder()
.GET()
.uri(constructListCustomerUri());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the extracted method

Comment on lines +224 to +227
var request = HttpRequest.newBuilder()
.GET()
.uri(customerId)
.build();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants