This repository has been archived by the owner on Feb 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into update-from-template-merged
- Loading branch information
Showing
47 changed files
with
2,926 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# 2.0.0 | ||
<i>Major refactoring</i> | ||
* Now requires less dependencies | ||
* API was changed so that it's easier usable | ||
* Requires Java 17+ | ||
* Updated dependencies | ||
|
||
# 1.0.0 | ||
Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
universe-client-demo/src/main/java/software/xdev/Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package software.xdev; | ||
|
||
import java.awt.Desktop; | ||
import java.io.IOException; | ||
import java.io.UncheckedIOException; | ||
import java.net.URI; | ||
import java.util.List; | ||
import java.util.Scanner; | ||
|
||
import software.xdev.universe.UniverseClient; | ||
import software.xdev.universe.UniverseConfiguration; | ||
import software.xdev.universe.requests.get_attendees.Attendee; | ||
import software.xdev.universe.requests.get_attendees.DefaultQuestions; | ||
import software.xdev.universe.requests.get_buyers.Buyer; | ||
import software.xdev.universe.requests.get_events.Event; | ||
|
||
|
||
public final class Application | ||
{ | ||
public static void main(final String[] args) | ||
{ | ||
final UniverseClient client = new UniverseClient(new UniverseConfiguration( | ||
System.getProperty("applicationId"), | ||
System.getProperty("applicationSecret"), | ||
System.getProperty("redirectUri"), | ||
System.getProperty("authorizationCode"), | ||
System.getProperty("bearerToken") | ||
)); | ||
|
||
// STEP 1: Get Authorization Code | ||
// After getting the authorization code it must be set in the microprofile-config.properties | ||
// or through client.getConfig().withAuthorizationCode() | ||
client.withAuthorizationCode(openBrowserToGetAuthorizationCodeAndWaitForInput(client)); | ||
|
||
// STEP 2: Get Bearer Token | ||
// After getting the bearer token it must be set in the microprofile-config.properties | ||
// or through client.getConfig().withBearerToken() | ||
client.withBearerToken(client.requestBearerToken().getAccessToken()); | ||
|
||
// STEP 3: Get Host Id | ||
final String hostId = client.requestHostId(); | ||
|
||
// STEP 4: Get Events | ||
final List<Event> events = client.requestEvents(hostId); | ||
events.forEach(event -> System.out.println(("Event: " + event.getTitle() + "(id:" + event.getId() + ")"))); | ||
|
||
// STEP 5: Get Buyers | ||
final List<Buyer> buyers = client.requestBuyersInEvent(events.get(0).getId(), 5, 0); | ||
buyers.forEach(buyer -> System.out.println(("Buyer: " + buyer.getName()))); | ||
|
||
// STEP 6: Get Attendees | ||
final List<Attendee> attendees = client.requestAttendeesInEvent(events.get(0).getId(), 5, 0); | ||
attendees.forEach(attendee -> | ||
System.out.println( | ||
"Attendee: " | ||
+ "\n Name: " + attendee.getTypedAnswerToQuestion(DefaultQuestions.FIRST_NAME) | ||
+ " " + attendee.getTypedAnswerToQuestion(DefaultQuestions.LAST_NAME) | ||
+ "\n Email: " + attendee.getTypedAnswerToQuestion(DefaultQuestions.EMAIL) | ||
+ "\n Company: " + attendee.getTypedAnswerToQuestion(DefaultQuestions.COMPANY) | ||
+ "\n Job: " + attendee.getTypedAnswerToQuestion(DefaultQuestions.JOB_TITLE) | ||
+ "\n Country: " + attendee.getTypedAnswerToQuestion(DefaultQuestions.COUNTRY) | ||
) | ||
); | ||
} | ||
|
||
private static String openBrowserToGetAuthorizationCodeAndWaitForInput(final UniverseClient client) | ||
{ | ||
if(Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) | ||
{ | ||
try | ||
{ | ||
Desktop.getDesktop().browse(URI.create(client.getUrlToGetAuthorizationCode())); | ||
} | ||
catch(final IOException ex) | ||
{ | ||
throw new UncheckedIOException(ex); | ||
} | ||
} | ||
try(final Scanner scanner = new Scanner(System.in)) | ||
{ | ||
System.out.println("Please input displayed authorization code:"); | ||
return scanner.nextLine(); | ||
} | ||
} | ||
|
||
private Application() | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.