Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Commit 763a8d8

Browse files
committed
Merge branch 'develop' into update-from-template-merged
2 parents 743c5c6 + 2335887 commit 763a8d8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2926
-47
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ body:
1414
attributes:
1515
label: "Checklist"
1616
options:
17-
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/template-placeholder/releases/latest)"
17+
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/universe-client/releases/latest)"
1818
required: true
19-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
19+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/universe-client/issues) or [closed](https://github.com/xdev-software/universe-client/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
2020
required: true
2121
- label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise."
2222
required: true

.github/ISSUE_TEMPLATE/enhancement.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ body:
1212
attributes:
1313
label: "Checklist"
1414
options:
15-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
15+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/universe-client/issues) or [closed](https://github.com/xdev-software/universe-client/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
1616
required: true
1717
- label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise."
1818
required: true

.github/ISSUE_TEMPLATE/question.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ body:
1212
attributes:
1313
label: "Checklist"
1414
options:
15-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
15+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/universe-client/issues) or [closed](https://github.com/xdev-software/universe-client/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
1616
required: true
1717
- label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise."
1818
required: true

.idea/checkstyle-idea.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.run/Run Demo.run.xml

-16
This file was deleted.

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# 2.0.0
2+
<i>Major refactoring</i>
3+
* Now requires less dependencies
4+
* API was changed so that it's easier usable
5+
* Requires Java 17+
6+
* Updated dependencies
7+
8+
# 1.0.0
9+
Initial release

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ You should have the following things installed:
3434
* Ensure that the JDK/Java-Version is correct
3535

3636

37-
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/release.yml?branch=master)](https://github.com/xdev-software/template-placeholder/actions/workflows/release.yml)
37+
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/universe-client/release.yml?branch=master)](https://github.com/xdev-software/universe-client/actions/workflows/release.yml)
3838

3939
Before releasing:
40-
* Consider doing a [test-deployment](https://github.com/xdev-software/template-placeholder/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
40+
* Consider doing a [test-deployment](https://github.com/xdev-software/universe-client/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
4141
* Check the [changelog](CHANGELOG.md)
4242

4343
If the ``develop`` is ready for release, create a pull request to the ``master``-Branch and merge the changes

README.md

+54-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,60 @@
1-
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/template-placeholder?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/template-placeholder)
2-
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/check-build.yml?branch=develop)](https://github.com/xdev-software/template-placeholder/actions/workflows/check-build.yml?query=branch%3Adevelop)
3-
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_template-placeholder&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_template-placeholder)
1+
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/universe-client?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/universe-client)
2+
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/universe-client/check-build.yml?branch=develop)](https://github.com/xdev-software/universe-client/actions/workflows/check-build.yml?query=branch%3Adevelop)
3+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_universe-client&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_universe-client)
44

5-
# template-placeholder
5+
# Universe client for Java
66

7+
A simple Java client for the [Universe API](https://developers.universe.com).
8+
9+
## Usage
10+
11+
The two basic entries are the ``ApplicationId`` and the ``RedirectUri``. They **must** be set.
12+
13+
If these two entries are set, you need to get ``AuthorizationCode``. This is a one-time-only code, which
14+
you get by calling the URL provided by ``client.getUrlToGetAuthorizationCode()``.
15+
16+
With this ``AuthorizationCode`` you can request a ``BearerToken``. You can can request the ``BearerToken`` only
17+
one time with one ``AuthorizationCode``. After that the ``AuthorizationCode`` is invalidated.
18+
This can be achieved with ``client.requestBearerToken()``.
19+
The ``BearerToken`` can be used for all your future requests. It is usually valid for one month.
20+
21+
If the ``BearerToken`` is set, you can use the actual API calls.
22+
23+
### Example
24+
Full example, see [Demo](universe-client-demo/src/main/java/software/xdev/Application.java).
25+
26+
```java
27+
UniverseClient client = new UniverseClient(yourConfig);
28+
29+
// Get Events
30+
List<Event> events = client.requestEvents(hostId);
31+
events.forEach(event -> logger.info("Event: " + event.getTitle() + "(id:" + event.getId() + ")"));
32+
33+
// Get Attendees
34+
List<Attendee> attendees = client.requestAttendeesInEvent(events.get(0).getId(), 5, 0);
35+
```
36+
37+
## GraphQL
38+
We are using the [Universe GraphQL API](https://developers.universe.com/docs/graphql).
39+
Here are some thing to help with orientation with GraphQL.
40+
41+
You can test requests on [Universes GraphiQL (Explorer)](https://www.universe.com/graphiql);
42+
43+
Get Schema:
44+
```
45+
{
46+
__schema {
47+
queryType {
48+
fields {
49+
name
50+
}
51+
}
52+
}
53+
}
54+
```
755

856
## Installation
9-
[Installation guide for the latest release](https://github.com/xdev-software/template-placeholder/releases/latest#Installation)
57+
[Installation guide for the latest release](https://github.com/xdev-software/universe-client/releases/latest#Installation)
1058

1159
## Support
1260
If you need support as soon as possible and you can't wait for any pull request, feel free to use [our support](https://xdev.software/en/services/support).
@@ -15,4 +63,4 @@ If you need support as soon as possible and you can't wait for any pull request,
1563
See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project.
1664

1765
## Dependencies and Licenses
18-
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/template-placeholder/dependencies)
66+
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/universe-client/dependencies)

SECURITY.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## Reporting a Vulnerability
44

5-
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/template-placeholder/security/advisories/new).
5+
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/universe-client/security/advisories/new).

pom.xml

+7-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>software.xdev</groupId>
8-
<artifactId>template-placeholder-root</artifactId>
9-
<version>1.0.0-SNAPSHOT</version>
8+
<artifactId>universe-client-root</artifactId>
9+
<version>2.0.1-SNAPSHOT</version>
1010
<packaging>pom</packaging>
1111

1212
<organization>
@@ -15,8 +15,8 @@
1515
</organization>
1616

1717
<modules>
18-
<module>template-placeholder</module>
19-
<module>template-placeholder-demo</module>
18+
<module>universe-client</module>
19+
<module>universe-client-demo</module>
2020
</modules>
2121

2222
<properties>
@@ -77,6 +77,9 @@
7777
<rulesets>
7878
<ruleset>.config/pmd/ruleset.xml</ruleset>
7979
</rulesets>
80+
<excludes>
81+
<exclude>software/xdev/universe/requests/**</exclude>
82+
</excludes>
8083
</configuration>
8184
<dependencies>
8285
<dependency>

renovate.json5

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"packageRules": [
55
{
66
"description": "Ignore project internal dependencies",
7-
"packagePattern": "^software.xdev:template-placeholder",
7+
"packagePattern": "^software.xdev:universe-client",
88
"datasources": [
99
"maven"
1010
],

template-placeholder-demo/pom.xml renamed to universe-client-demo/pom.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
<parent>
88
<groupId>software.xdev</groupId>
9-
<artifactId>template-placeholder-root</artifactId>
10-
<version>1.0.0-SNAPSHOT</version>
9+
<artifactId>universe-client-root</artifactId>
10+
<version>2.0.1-SNAPSHOT</version>
1111
</parent>
1212

13-
<artifactId>template-placeholder-demo</artifactId>
14-
<version>1.0.0-SNAPSHOT</version>
13+
<artifactId>universe-client-demo</artifactId>
14+
<version>2.0.1-SNAPSHOT</version>
1515
<packaging>jar</packaging>
1616

1717
<organization>
@@ -32,7 +32,7 @@
3232
<dependencies>
3333
<dependency>
3434
<groupId>software.xdev</groupId>
35-
<artifactId>template-placeholder</artifactId>
35+
<artifactId>universe-client</artifactId>
3636
<version>${project.version}</version>
3737
</dependency>
3838
</dependencies>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
package software.xdev;
2+
3+
import java.awt.Desktop;
4+
import java.io.IOException;
5+
import java.io.UncheckedIOException;
6+
import java.net.URI;
7+
import java.util.List;
8+
import java.util.Scanner;
9+
10+
import software.xdev.universe.UniverseClient;
11+
import software.xdev.universe.UniverseConfiguration;
12+
import software.xdev.universe.requests.get_attendees.Attendee;
13+
import software.xdev.universe.requests.get_attendees.DefaultQuestions;
14+
import software.xdev.universe.requests.get_buyers.Buyer;
15+
import software.xdev.universe.requests.get_events.Event;
16+
17+
18+
public final class Application
19+
{
20+
public static void main(final String[] args)
21+
{
22+
final UniverseClient client = new UniverseClient(new UniverseConfiguration(
23+
System.getProperty("applicationId"),
24+
System.getProperty("applicationSecret"),
25+
System.getProperty("redirectUri"),
26+
System.getProperty("authorizationCode"),
27+
System.getProperty("bearerToken")
28+
));
29+
30+
// STEP 1: Get Authorization Code
31+
// After getting the authorization code it must be set in the microprofile-config.properties
32+
// or through client.getConfig().withAuthorizationCode()
33+
client.withAuthorizationCode(openBrowserToGetAuthorizationCodeAndWaitForInput(client));
34+
35+
// STEP 2: Get Bearer Token
36+
// After getting the bearer token it must be set in the microprofile-config.properties
37+
// or through client.getConfig().withBearerToken()
38+
client.withBearerToken(client.requestBearerToken().getAccessToken());
39+
40+
// STEP 3: Get Host Id
41+
final String hostId = client.requestHostId();
42+
43+
// STEP 4: Get Events
44+
final List<Event> events = client.requestEvents(hostId);
45+
events.forEach(event -> System.out.println(("Event: " + event.getTitle() + "(id:" + event.getId() + ")")));
46+
47+
// STEP 5: Get Buyers
48+
final List<Buyer> buyers = client.requestBuyersInEvent(events.get(0).getId(), 5, 0);
49+
buyers.forEach(buyer -> System.out.println(("Buyer: " + buyer.getName())));
50+
51+
// STEP 6: Get Attendees
52+
final List<Attendee> attendees = client.requestAttendeesInEvent(events.get(0).getId(), 5, 0);
53+
attendees.forEach(attendee ->
54+
System.out.println(
55+
"Attendee: "
56+
+ "\n Name: " + attendee.getTypedAnswerToQuestion(DefaultQuestions.FIRST_NAME)
57+
+ " " + attendee.getTypedAnswerToQuestion(DefaultQuestions.LAST_NAME)
58+
+ "\n Email: " + attendee.getTypedAnswerToQuestion(DefaultQuestions.EMAIL)
59+
+ "\n Company: " + attendee.getTypedAnswerToQuestion(DefaultQuestions.COMPANY)
60+
+ "\n Job: " + attendee.getTypedAnswerToQuestion(DefaultQuestions.JOB_TITLE)
61+
+ "\n Country: " + attendee.getTypedAnswerToQuestion(DefaultQuestions.COUNTRY)
62+
)
63+
);
64+
}
65+
66+
private static String openBrowserToGetAuthorizationCodeAndWaitForInput(final UniverseClient client)
67+
{
68+
if(Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE))
69+
{
70+
try
71+
{
72+
Desktop.getDesktop().browse(URI.create(client.getUrlToGetAuthorizationCode()));
73+
}
74+
catch(final IOException ex)
75+
{
76+
throw new UncheckedIOException(ex);
77+
}
78+
}
79+
try(final Scanner scanner = new Scanner(System.in))
80+
{
81+
System.out.println("Please input displayed authorization code:");
82+
return scanner.nextLine();
83+
}
84+
}
85+
86+
private Application()
87+
{
88+
}
89+
}

template-placeholder/pom.xml renamed to universe-client/pom.xml

+24-7
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>software.xdev</groupId>
8-
<artifactId>template-placeholder</artifactId>
9-
<version>1.0.0-SNAPSHOT</version>
8+
<artifactId>universe-client</artifactId>
9+
<version>2.0.1-SNAPSHOT</version>
1010
<packaging>jar</packaging>
1111

12-
<name>template-placeholder</name>
13-
<description>template-placeholder</description>
14-
<url>https://github.com/xdev-software/template-placeholder</url>
12+
<name>universe-client</name>
13+
<description>universe-client</description>
14+
<url>https://github.com/xdev-software/universe-client</url>
1515

1616
<scm>
17-
<url>https://github.com/xdev-software/template-placeholder</url>
18-
<connection>scm:git:https://github.com/xdev-software/template-placeholder.git</connection>
17+
<url>https://github.com/xdev-software/universe-client</url>
18+
<connection>scm:git:https://github.com/xdev-software/universe-client.git</connection>
1919
</scm>
2020

2121
<inceptionYear>2023</inceptionYear>
@@ -84,6 +84,20 @@
8484
</repository>
8585
</distributionManagement>
8686

87+
<dependencies>
88+
<dependency>
89+
<groupId>org.apache.httpcomponents.client5</groupId>
90+
<artifactId>httpclient5</artifactId>
91+
<version>5.3.1</version>
92+
</dependency>
93+
94+
<dependency>
95+
<groupId>com.fasterxml.jackson.core</groupId>
96+
<artifactId>jackson-databind</artifactId>
97+
<version>2.17.1</version>
98+
</dependency>
99+
</dependencies>
100+
87101
<build>
88102
<pluginManagement>
89103
<plugins>
@@ -279,6 +293,9 @@
279293
<rulesets>
280294
<ruleset>../.config/pmd/ruleset.xml</ruleset>
281295
</rulesets>
296+
<excludes>
297+
<exclude>software/xdev/universe/requests/**</exclude>
298+
</excludes>
282299
</configuration>
283300
<dependencies>
284301
<dependency>

0 commit comments

Comments
 (0)