AlexaClient(final AlexaClientBuilder builder) { this.millisFromCurrentDate = builder.timestamp.getTime() - new Date().getTime(); this.locale = builder.locale; apiEndpoint = apiEndpoints.getOrDefault(builder.apiEndpoint, apiEndpoints.get(NA)); this.application = new Application(builder.applicationId); this.user = User.builder().withUserId(builder.uid).withAccessToken(builder.accessToken).build(); this.device = builder.device; this.debugFlagSessionAttributeName = StringUtils.isNullOrEmpty(builder.debugFlagSessionAttributeName) ? Optional.empty() : Optional.of(builder.debugFlagSessionAttributeName); this.endpoint = builder.endpoint; this.yLaunch = builder.yLaunch; }
private Session givenSession(final String applicationId) { final Application application = new Application(applicationId); final User user = User.builder().withUserId(userId).withAccessToken("accessToken").build(); return Session.builder().withSessionId(sessionId) .withApplication(application).withUser(user).build(); }